OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |