| 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 <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 return type_; | 618 return type_; |
| 619 } | 619 } |
| 620 | 620 |
| 621 DemuxerStream::Liveness FFmpegDemuxerStream::liveness() const { | 621 DemuxerStream::Liveness FFmpegDemuxerStream::liveness() const { |
| 622 DCHECK(task_runner_->BelongsToCurrentThread()); | 622 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 623 return liveness_; | 623 return liveness_; |
| 624 } | 624 } |
| 625 | 625 |
| 626 void FFmpegDemuxerStream::Read(const ReadCB& read_cb) { | 626 void FFmpegDemuxerStream::Read(const ReadCB& read_cb) { |
| 627 DCHECK(task_runner_->BelongsToCurrentThread()); | 627 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 628 CHECK(read_cb_.is_null()) << "Overlapping reads are not supported"; | 628 // Overlapping reads are not supported |
| 629 CHECK(read_cb_.is_null()); |
| 629 read_cb_ = BindToCurrentLoop(read_cb); | 630 read_cb_ = BindToCurrentLoop(read_cb); |
| 630 | 631 |
| 631 // Don't accept any additional reads if we've been told to stop. | 632 // Don't accept any additional reads if we've been told to stop. |
| 632 // The |demuxer_| may have been destroyed in the pipeline thread. | 633 // The |demuxer_| may have been destroyed in the pipeline thread. |
| 633 // | 634 // |
| 634 // TODO(scherkus): it would be cleaner to reply with an error message. | 635 // TODO(scherkus): it would be cleaner to reply with an error message. |
| 635 if (!demuxer_) { | 636 if (!demuxer_) { |
| 636 base::ResetAndReturn(&read_cb_).Run( | 637 base::ResetAndReturn(&read_cb_).Run( |
| 637 DemuxerStream::kOk, DecoderBuffer::CreateEOSBuffer()); | 638 DemuxerStream::kOk, DecoderBuffer::CreateEOSBuffer()); |
| 638 return; | 639 return; |
| (...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1804 | 1805 |
| 1805 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { | 1806 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { |
| 1806 DCHECK(task_runner_->BelongsToCurrentThread()); | 1807 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 1807 for (const auto& stream : streams_) { | 1808 for (const auto& stream : streams_) { |
| 1808 if (stream) | 1809 if (stream) |
| 1809 stream->SetLiveness(liveness); | 1810 stream->SetLiveness(liveness); |
| 1810 } | 1811 } |
| 1811 } | 1812 } |
| 1812 | 1813 |
| 1813 } // namespace media | 1814 } // namespace media |
| OLD | NEW |