OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 // let FFmpeg demuxer methods to run on. | 328 // let FFmpeg demuxer methods to run on. |
329 size_t last_read_bytes = WaitForRead(); | 329 size_t last_read_bytes = WaitForRead(); |
330 if (last_read_bytes == DataSource::kReadError) { | 330 if (last_read_bytes == DataSource::kReadError) { |
331 host()->SetError(PIPELINE_ERROR_READ); | 331 host()->SetError(PIPELINE_ERROR_READ); |
332 | 332 |
333 // Returns with a negative number to signal an error to FFmpeg. | 333 // Returns with a negative number to signal an error to FFmpeg. |
334 read_has_failed_ = true; | 334 read_has_failed_ = true; |
335 return AVERROR_IO; | 335 return AVERROR_IO; |
336 } | 336 } |
337 read_position_ += last_read_bytes; | 337 read_position_ += last_read_bytes; |
| 338 |
| 339 host()->SetCurrentReadPosition(read_position_); |
| 340 |
338 return last_read_bytes; | 341 return last_read_bytes; |
339 } | 342 } |
340 | 343 |
341 bool FFmpegDemuxer::GetPosition(int64* position_out) { | 344 bool FFmpegDemuxer::GetPosition(int64* position_out) { |
342 *position_out = read_position_; | 345 *position_out = read_position_; |
343 return true; | 346 return true; |
344 } | 347 } |
345 | 348 |
346 bool FFmpegDemuxer::SetPosition(int64 position) { | 349 bool FFmpegDemuxer::SetPosition(int64 position) { |
347 DCHECK(data_source_); | 350 DCHECK(data_source_); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 read_event_.Wait(); | 616 read_event_.Wait(); |
614 return last_read_bytes_; | 617 return last_read_bytes_; |
615 } | 618 } |
616 | 619 |
617 void FFmpegDemuxer::SignalReadCompleted(size_t size) { | 620 void FFmpegDemuxer::SignalReadCompleted(size_t size) { |
618 last_read_bytes_ = size; | 621 last_read_bytes_ = size; |
619 read_event_.Signal(); | 622 read_event_.Signal(); |
620 } | 623 } |
621 | 624 |
622 } // namespace media | 625 } // namespace media |
OLD | NEW |