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/ffmpeg_demuxer.h" | 5 #include "media/filters/ffmpeg_demuxer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 // let FFmpeg demuxer methods to run on. | 391 // let FFmpeg demuxer methods to run on. |
392 int last_read_bytes = WaitForRead(); | 392 int last_read_bytes = WaitForRead(); |
393 if (last_read_bytes == DataSource::kReadError) { | 393 if (last_read_bytes == DataSource::kReadError) { |
394 host_->OnDemuxerError(PIPELINE_ERROR_READ); | 394 host_->OnDemuxerError(PIPELINE_ERROR_READ); |
395 | 395 |
396 // Returns with a negative number to signal an error to FFmpeg. | 396 // Returns with a negative number to signal an error to FFmpeg. |
397 read_has_failed_ = true; | 397 read_has_failed_ = true; |
398 return AVERROR(EIO); | 398 return AVERROR(EIO); |
399 } | 399 } |
400 read_position_ += last_read_bytes; | 400 read_position_ += last_read_bytes; |
401 host_->SetCurrentReadPosition(read_position_); | |
402 | 401 |
403 return last_read_bytes; | 402 return last_read_bytes; |
404 } | 403 } |
405 | 404 |
406 bool FFmpegDemuxer::GetPosition(int64* position_out) { | 405 bool FFmpegDemuxer::GetPosition(int64* position_out) { |
407 DCHECK(host_); | 406 DCHECK(host_); |
408 *position_out = read_position_; | 407 *position_out = read_position_; |
409 return true; | 408 return true; |
410 } | 409 } |
411 | 410 |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 read_event_.Wait(); | 749 read_event_.Wait(); |
751 return last_read_bytes_; | 750 return last_read_bytes_; |
752 } | 751 } |
753 | 752 |
754 void FFmpegDemuxer::SignalReadCompleted(int size) { | 753 void FFmpegDemuxer::SignalReadCompleted(int size) { |
755 last_read_bytes_ = size; | 754 last_read_bytes_ = size; |
756 read_event_.Signal(); | 755 read_event_.Signal(); |
757 } | 756 } |
758 | 757 |
759 } // namespace media | 758 } // namespace media |
OLD | NEW |