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 <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 return ConvertFromTimeBase(time_base, timestamp); | 733 return ConvertFromTimeBase(time_base, timestamp); |
734 } | 734 } |
735 | 735 |
736 // | 736 // |
737 // FFmpegDemuxer | 737 // FFmpegDemuxer |
738 // | 738 // |
739 FFmpegDemuxer::FFmpegDemuxer( | 739 FFmpegDemuxer::FFmpegDemuxer( |
740 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 740 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
741 DataSource* data_source, | 741 DataSource* data_source, |
742 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, | 742 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, |
| 743 const MediaTracksUpdatedCB& media_tracks_updated_cb, |
743 const scoped_refptr<MediaLog>& media_log) | 744 const scoped_refptr<MediaLog>& media_log) |
744 : host_(NULL), | 745 : host_(NULL), |
745 task_runner_(task_runner), | 746 task_runner_(task_runner), |
746 blocking_thread_("FFmpegDemuxer"), | 747 blocking_thread_("FFmpegDemuxer"), |
747 pending_read_(false), | 748 pending_read_(false), |
748 pending_seek_(false), | 749 pending_seek_(false), |
749 data_source_(data_source), | 750 data_source_(data_source), |
750 media_log_(media_log), | 751 media_log_(media_log), |
751 bitrate_(0), | 752 bitrate_(0), |
752 start_time_(kNoTimestamp()), | 753 start_time_(kNoTimestamp()), |
753 preferred_stream_for_seeking_(-1, kNoTimestamp()), | 754 preferred_stream_for_seeking_(-1, kNoTimestamp()), |
754 fallback_stream_for_seeking_(-1, kNoTimestamp()), | 755 fallback_stream_for_seeking_(-1, kNoTimestamp()), |
755 text_enabled_(false), | 756 text_enabled_(false), |
756 duration_known_(false), | 757 duration_known_(false), |
757 encrypted_media_init_data_cb_(encrypted_media_init_data_cb), | 758 encrypted_media_init_data_cb_(encrypted_media_init_data_cb), |
| 759 media_tracks_updated_cb_(media_tracks_updated_cb), |
758 weak_factory_(this) { | 760 weak_factory_(this) { |
759 DCHECK(task_runner_.get()); | 761 DCHECK(task_runner_.get()); |
760 DCHECK(data_source_); | 762 DCHECK(data_source_); |
| 763 DCHECK(!media_tracks_updated_cb_.is_null()); |
761 } | 764 } |
762 | 765 |
763 FFmpegDemuxer::~FFmpegDemuxer() {} | 766 FFmpegDemuxer::~FFmpegDemuxer() {} |
764 | 767 |
765 void FFmpegDemuxer::Stop() { | 768 void FFmpegDemuxer::Stop() { |
766 DCHECK(task_runner_->BelongsToCurrentThread()); | 769 DCHECK(task_runner_->BelongsToCurrentThread()); |
767 | 770 |
768 // The order of Stop() and Abort() is important here. If Abort() is called | 771 // The order of Stop() and Abort() is important here. If Abort() is called |
769 // first, control may pass into FFmpeg where it can destruct buffers that are | 772 // first, control may pass into FFmpeg where it can destruct buffers that are |
770 // in the process of being fulfilled by the DataSource. | 773 // in the process of being fulfilled by the DataSource. |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 | 1511 |
1509 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { | 1512 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { |
1510 DCHECK(task_runner_->BelongsToCurrentThread()); | 1513 DCHECK(task_runner_->BelongsToCurrentThread()); |
1511 for (const auto& stream : streams_) { // |stream| is a ref to a pointer. | 1514 for (const auto& stream : streams_) { // |stream| is a ref to a pointer. |
1512 if (stream) | 1515 if (stream) |
1513 stream->SetLiveness(liveness); | 1516 stream->SetLiveness(liveness); |
1514 } | 1517 } |
1515 } | 1518 } |
1516 | 1519 |
1517 } // namespace media | 1520 } // namespace media |
OLD | NEW |