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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <deque> | 9 #include <deque> |
10 #include <string> | 10 #include <string> |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 CreateDataSource(name); | 101 CreateDataSource(name); |
102 | 102 |
103 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = base::Bind( | 103 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = base::Bind( |
104 &FFmpegDemuxerTest::OnEncryptedMediaInitData, base::Unretained(this)); | 104 &FFmpegDemuxerTest::OnEncryptedMediaInitData, base::Unretained(this)); |
105 | 105 |
106 Demuxer::MediaTracksUpdatedCB tracks_updated_cb = base::Bind( | 106 Demuxer::MediaTracksUpdatedCB tracks_updated_cb = base::Bind( |
107 &FFmpegDemuxerTest::OnMediaTracksUpdated, base::Unretained(this)); | 107 &FFmpegDemuxerTest::OnMediaTracksUpdated, base::Unretained(this)); |
108 | 108 |
109 demuxer_.reset(new FFmpegDemuxer( | 109 demuxer_.reset(new FFmpegDemuxer( |
110 base::ThreadTaskRunnerHandle::Get(), data_source_.get(), | 110 base::ThreadTaskRunnerHandle::Get(), data_source_.get(), |
111 encrypted_media_init_data_cb, tracks_updated_cb, new MediaLog())); | 111 encrypted_media_init_data_cb, tracks_updated_cb, &media_log_)); |
112 } | 112 } |
113 | 113 |
114 DemuxerStream* GetStream(DemuxerStream::Type type) { | 114 DemuxerStream* GetStream(DemuxerStream::Type type) { |
115 std::vector<DemuxerStream*> streams = demuxer_->GetAllStreams(); | 115 std::vector<DemuxerStream*> streams = demuxer_->GetAllStreams(); |
116 for (auto* stream : streams) { | 116 for (auto* stream : streams) { |
117 if (stream->type() == type) | 117 if (stream->type() == type) |
118 return stream; | 118 return stream; |
119 } | 119 } |
120 return nullptr; | 120 return nullptr; |
121 } | 121 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // Accessor to demuxer internals. | 239 // Accessor to demuxer internals. |
240 void SetDurationKnown(bool duration_known) { | 240 void SetDurationKnown(bool duration_known) { |
241 demuxer_->duration_known_ = duration_known; | 241 demuxer_->duration_known_ = duration_known; |
242 if (!duration_known) | 242 if (!duration_known) |
243 demuxer_->duration_ = kInfiniteDuration; | 243 demuxer_->duration_ = kInfiniteDuration; |
244 } | 244 } |
245 | 245 |
246 // Fixture members. | 246 // Fixture members. |
247 | 247 |
248 base::test::ScopedTaskScheduler task_scheduler_; | 248 base::test::ScopedTaskScheduler task_scheduler_; |
| 249 MediaLog media_log_; |
249 std::unique_ptr<FileDataSource> data_source_; | 250 std::unique_ptr<FileDataSource> data_source_; |
250 std::unique_ptr<FFmpegDemuxer> demuxer_; | 251 std::unique_ptr<FFmpegDemuxer> demuxer_; |
251 StrictMock<MockDemuxerHost> host_; | 252 StrictMock<MockDemuxerHost> host_; |
252 std::unique_ptr<MediaTracks> media_tracks_; | 253 std::unique_ptr<MediaTracks> media_tracks_; |
253 | 254 |
254 AVFormatContext* format_context() { | 255 AVFormatContext* format_context() { |
255 return demuxer_->glue_->format_context(); | 256 return demuxer_->glue_->format_context(); |
256 } | 257 } |
257 | 258 |
258 DemuxerStream* preferred_seeking_stream(base::TimeDelta seek_time) const { | 259 DemuxerStream* preferred_seeking_stream(base::TimeDelta seek_time) const { |
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1592 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); | 1593 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); |
1593 | 1594 |
1594 // Now pretend that audio stream got disabled. | 1595 // Now pretend that audio stream got disabled. |
1595 astream->SetEnabled(false, base::TimeDelta()); | 1596 astream->SetEnabled(false, base::TimeDelta()); |
1596 // Since there's no other enabled streams, the preferred seeking stream should | 1597 // Since there's no other enabled streams, the preferred seeking stream should |
1597 // still be the audio stream. | 1598 // still be the audio stream. |
1598 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); | 1599 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); |
1599 } | 1600 } |
1600 | 1601 |
1601 } // namespace media | 1602 } // namespace media |
OLD | NEW |