| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 } | 704 } |
| 705 | 705 |
| 706 void FFmpegDemuxerStream::set_enabled(bool enabled, base::TimeDelta timestamp) { | 706 void FFmpegDemuxerStream::set_enabled(bool enabled, base::TimeDelta timestamp) { |
| 707 DCHECK(task_runner_->BelongsToCurrentThread()); | 707 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 708 if (enabled == is_enabled_) | 708 if (enabled == is_enabled_) |
| 709 return; | 709 return; |
| 710 | 710 |
| 711 is_enabled_ = enabled; | 711 is_enabled_ = enabled; |
| 712 if (is_enabled_) { | 712 if (is_enabled_) { |
| 713 waiting_for_keyframe_ = true; | 713 waiting_for_keyframe_ = true; |
| 714 if (!stream_restarted_cb_.is_null()) | |
| 715 stream_restarted_cb_.Run(this, timestamp); | |
| 716 } | 714 } |
| 717 if (!is_enabled_ && !read_cb_.is_null()) { | 715 if (!is_enabled_ && !read_cb_.is_null()) { |
| 718 DVLOG(1) << "Read from disabled stream, returning EOS"; | 716 DVLOG(1) << "Read from disabled stream, returning EOS"; |
| 719 base::ResetAndReturn(&read_cb_).Run(kOk, DecoderBuffer::CreateEOSBuffer()); | 717 base::ResetAndReturn(&read_cb_).Run(kOk, DecoderBuffer::CreateEOSBuffer()); |
| 720 return; | 718 return; |
| 721 } | 719 } |
| 720 if (!stream_status_change_cb_.is_null()) |
| 721 stream_status_change_cb_.Run(is_enabled_, timestamp); |
| 722 } | 722 } |
| 723 | 723 |
| 724 void FFmpegDemuxerStream::SetStreamRestartedCB(const StreamRestartedCB& cb) { | 724 void FFmpegDemuxerStream::SetStreamStatusChangeCB( |
| 725 const StreamStatusChangeCB& cb) { |
| 725 DCHECK(!cb.is_null()); | 726 DCHECK(!cb.is_null()); |
| 726 stream_restarted_cb_ = cb; | 727 stream_status_change_cb_ = cb; |
| 727 } | 728 } |
| 728 | 729 |
| 729 void FFmpegDemuxerStream::SetLiveness(Liveness liveness) { | 730 void FFmpegDemuxerStream::SetLiveness(Liveness liveness) { |
| 730 DCHECK(task_runner_->BelongsToCurrentThread()); | 731 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 731 DCHECK_EQ(liveness_, LIVENESS_UNKNOWN); | 732 DCHECK_EQ(liveness_, LIVENESS_UNKNOWN); |
| 732 liveness_ = liveness; | 733 liveness_ = liveness; |
| 733 } | 734 } |
| 734 | 735 |
| 735 base::TimeDelta FFmpegDemuxerStream::GetElapsedTime() const { | 736 base::TimeDelta FFmpegDemuxerStream::GetElapsedTime() const { |
| 736 return ConvertStreamTimestamp(stream_->time_base, stream_->cur_dts); | 737 return ConvertStreamTimestamp(stream_->time_base, stream_->cur_dts); |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1696 | 1697 |
| 1697 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { | 1698 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { |
| 1698 DCHECK(task_runner_->BelongsToCurrentThread()); | 1699 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 1699 for (auto* stream : streams_) { | 1700 for (auto* stream : streams_) { |
| 1700 if (stream) | 1701 if (stream) |
| 1701 stream->SetLiveness(liveness); | 1702 stream->SetLiveness(liveness); |
| 1702 } | 1703 } |
| 1703 } | 1704 } |
| 1704 | 1705 |
| 1705 } // namespace media | 1706 } // namespace media |
| OLD | NEW |