| 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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 text_enabled_(false), | 779 text_enabled_(false), |
| 780 duration_known_(false), | 780 duration_known_(false), |
| 781 encrypted_media_init_data_cb_(encrypted_media_init_data_cb), | 781 encrypted_media_init_data_cb_(encrypted_media_init_data_cb), |
| 782 media_tracks_updated_cb_(media_tracks_updated_cb), | 782 media_tracks_updated_cb_(media_tracks_updated_cb), |
| 783 weak_factory_(this) { | 783 weak_factory_(this) { |
| 784 DCHECK(task_runner_.get()); | 784 DCHECK(task_runner_.get()); |
| 785 DCHECK(data_source_); | 785 DCHECK(data_source_); |
| 786 DCHECK(!media_tracks_updated_cb_.is_null()); | 786 DCHECK(!media_tracks_updated_cb_.is_null()); |
| 787 } | 787 } |
| 788 | 788 |
| 789 FFmpegDemuxer::~FFmpegDemuxer() {} | 789 FFmpegDemuxer::~FFmpegDemuxer() { |
| 790 // NOTE: This class is not destroyed on |task_runner|, so we must ensure that |
| 791 // there are no outstanding WeakPtrs by the time we reach here. |
| 792 DCHECK(!weak_factory_.HasWeakPtrs()); |
| 793 } |
| 790 | 794 |
| 791 std::string FFmpegDemuxer::GetDisplayName() const { | 795 std::string FFmpegDemuxer::GetDisplayName() const { |
| 792 return "FFmpegDemuxer"; | 796 return "FFmpegDemuxer"; |
| 793 } | 797 } |
| 794 | 798 |
| 795 void FFmpegDemuxer::Initialize(DemuxerHost* host, | 799 void FFmpegDemuxer::Initialize(DemuxerHost* host, |
| 796 const PipelineStatusCB& status_cb, | 800 const PipelineStatusCB& status_cb, |
| 797 bool enable_text_tracks) { | 801 bool enable_text_tracks) { |
| 798 DCHECK(task_runner_->BelongsToCurrentThread()); | 802 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 799 host_ = host; | 803 host_ = host; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 // thread and drop their results on the floor. | 845 // thread and drop their results on the floor. |
| 842 blocking_thread_.Stop(); | 846 blocking_thread_.Stop(); |
| 843 | 847 |
| 844 StreamVector::iterator iter; | 848 StreamVector::iterator iter; |
| 845 for (iter = streams_.begin(); iter != streams_.end(); ++iter) { | 849 for (iter = streams_.begin(); iter != streams_.end(); ++iter) { |
| 846 if (*iter) | 850 if (*iter) |
| 847 (*iter)->Stop(); | 851 (*iter)->Stop(); |
| 848 } | 852 } |
| 849 | 853 |
| 850 data_source_ = NULL; | 854 data_source_ = NULL; |
| 855 |
| 856 // Invalidate WeakPtrs on |task_runner_|, destruction may happen on another |
| 857 // thread. |
| 858 weak_factory_.InvalidateWeakPtrs(); |
| 851 } | 859 } |
| 852 | 860 |
| 853 void FFmpegDemuxer::StartWaitingForSeek(base::TimeDelta seek_time) {} | 861 void FFmpegDemuxer::StartWaitingForSeek(base::TimeDelta seek_time) {} |
| 854 | 862 |
| 855 void FFmpegDemuxer::CancelPendingSeek(base::TimeDelta seek_time) {} | 863 void FFmpegDemuxer::CancelPendingSeek(base::TimeDelta seek_time) {} |
| 856 | 864 |
| 857 void FFmpegDemuxer::Seek(base::TimeDelta time, const PipelineStatusCB& cb) { | 865 void FFmpegDemuxer::Seek(base::TimeDelta time, const PipelineStatusCB& cb) { |
| 858 DCHECK(task_runner_->BelongsToCurrentThread()); | 866 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 859 CHECK(!pending_seek_); | 867 CHECK(!pending_seek_); |
| 860 | 868 |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 | 1604 |
| 1597 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { | 1605 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { |
| 1598 DCHECK(task_runner_->BelongsToCurrentThread()); | 1606 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 1599 for (const auto& stream : streams_) { // |stream| is a ref to a pointer. | 1607 for (const auto& stream : streams_) { // |stream| is a ref to a pointer. |
| 1600 if (stream) | 1608 if (stream) |
| 1601 stream->SetLiveness(liveness); | 1609 stream->SetLiveness(liveness); |
| 1602 } | 1610 } |
| 1603 } | 1611 } |
| 1604 | 1612 |
| 1605 } // namespace media | 1613 } // namespace media |
| OLD | NEW |