Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: media/filters/blocking_url_protocol.cc

Issue 2267963002: Add support for cancellation of demuxer reads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add tests. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/blink/multibuffer_data_source_unittest.cc ('k') | media/filters/chunk_demuxer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/blocking_url_protocol.h" 5 #include "media/filters/blocking_url_protocol.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 if (events[index] == &aborted_) 56 if (events[index] == &aborted_)
57 return AVERROR(EIO); 57 return AVERROR(EIO);
58 58
59 if (last_read_bytes_ == DataSource::kReadError) { 59 if (last_read_bytes_ == DataSource::kReadError) {
60 aborted_.Signal(); 60 aborted_.Signal();
61 error_cb_.Run(); 61 error_cb_.Run();
62 return AVERROR(EIO); 62 return AVERROR(EIO);
63 } 63 }
64 64
65 if (last_read_bytes_ == DataSource::kAborted)
66 return AVERROR(EIO);
67
65 read_position_ += last_read_bytes_; 68 read_position_ += last_read_bytes_;
66 return last_read_bytes_; 69 return last_read_bytes_;
67 } 70 }
68 71
69 bool BlockingUrlProtocol::GetPosition(int64_t* position_out) { 72 bool BlockingUrlProtocol::GetPosition(int64_t* position_out) {
70 *position_out = read_position_; 73 *position_out = read_position_;
71 return true; 74 return true;
72 } 75 }
73 76
74 bool BlockingUrlProtocol::SetPosition(int64_t position) { 77 bool BlockingUrlProtocol::SetPosition(int64_t position) {
(...skipping 14 matching lines...) Expand all
89 bool BlockingUrlProtocol::IsStreaming() { 92 bool BlockingUrlProtocol::IsStreaming() {
90 return data_source_->IsStreaming(); 93 return data_source_->IsStreaming();
91 } 94 }
92 95
93 void BlockingUrlProtocol::SignalReadCompleted(int size) { 96 void BlockingUrlProtocol::SignalReadCompleted(int size) {
94 last_read_bytes_ = size; 97 last_read_bytes_ = size;
95 read_complete_.Signal(); 98 read_complete_.Signal();
96 } 99 }
97 100
98 } // namespace media 101 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/multibuffer_data_source_unittest.cc ('k') | media/filters/chunk_demuxer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698