| 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> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 18 #include "media/base/decrypt_config.h" | 18 #include "media/base/decrypt_config.h" |
| 19 #include "media/base/media_log.h" | 19 #include "media/base/media_log.h" |
| 20 #include "media/base/media_tracks.h" |
| 20 #include "media/base/mock_demuxer_host.h" | 21 #include "media/base/mock_demuxer_host.h" |
| 21 #include "media/base/test_helpers.h" | 22 #include "media/base/test_helpers.h" |
| 22 #include "media/base/timestamp_constants.h" | 23 #include "media/base/timestamp_constants.h" |
| 23 #include "media/ffmpeg/ffmpeg_common.h" | 24 #include "media/ffmpeg/ffmpeg_common.h" |
| 24 #include "media/filters/ffmpeg_demuxer.h" | 25 #include "media/filters/ffmpeg_demuxer.h" |
| 25 #include "media/filters/file_data_source.h" | 26 #include "media/filters/file_data_source.h" |
| 26 #include "media/formats/mp4/avc.h" | 27 #include "media/formats/mp4/avc.h" |
| 27 #include "media/media_features.h" | 28 #include "media/media_features.h" |
| 28 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 29 | 30 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 void CreateDemuxer(const std::string& name) { | 85 void CreateDemuxer(const std::string& name) { |
| 85 CHECK(!demuxer_); | 86 CHECK(!demuxer_); |
| 86 | 87 |
| 87 EXPECT_CALL(host_, OnBufferedTimeRangesChanged(_)).Times(AnyNumber()); | 88 EXPECT_CALL(host_, OnBufferedTimeRangesChanged(_)).Times(AnyNumber()); |
| 88 | 89 |
| 89 CreateDataSource(name); | 90 CreateDataSource(name); |
| 90 | 91 |
| 91 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = base::Bind( | 92 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = base::Bind( |
| 92 &FFmpegDemuxerTest::OnEncryptedMediaInitData, base::Unretained(this)); | 93 &FFmpegDemuxerTest::OnEncryptedMediaInitData, base::Unretained(this)); |
| 93 | 94 |
| 95 Demuxer::MediaTracksUpdatedCB tracks_updated_cb = base::Bind( |
| 96 &FFmpegDemuxerTest::OnMediaTracksUpdated, base::Unretained(this)); |
| 97 |
| 94 demuxer_.reset(new FFmpegDemuxer( | 98 demuxer_.reset(new FFmpegDemuxer( |
| 95 message_loop_.task_runner(), data_source_.get(), | 99 message_loop_.task_runner(), data_source_.get(), |
| 96 encrypted_media_init_data_cb, new MediaLog())); | 100 encrypted_media_init_data_cb, tracks_updated_cb, new MediaLog())); |
| 97 } | 101 } |
| 98 | 102 |
| 99 MOCK_METHOD1(CheckPoint, void(int v)); | 103 MOCK_METHOD1(CheckPoint, void(int v)); |
| 100 | 104 |
| 101 void InitializeDemuxerInternal(bool enable_text, | 105 void InitializeDemuxerInternal(bool enable_text, |
| 102 media::PipelineStatus expected_pipeline_status, | 106 media::PipelineStatus expected_pipeline_status, |
| 103 base::Time timeline_offset) { | 107 base::Time timeline_offset) { |
| 104 if (expected_pipeline_status == PIPELINE_OK) | 108 if (expected_pipeline_status == PIPELINE_OK) |
| 105 EXPECT_CALL(host_, SetDuration(_)); | 109 EXPECT_CALL(host_, SetDuration(_)); |
| 106 WaitableMessageLoopEvent event; | 110 WaitableMessageLoopEvent event; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 return base::Bind(&FFmpegDemuxerTest::OnReadDone, | 201 return base::Bind(&FFmpegDemuxerTest::OnReadDone, |
| 198 base::Unretained(this), | 202 base::Unretained(this), |
| 199 location, | 203 location, |
| 200 read_expectation); | 204 read_expectation); |
| 201 } | 205 } |
| 202 | 206 |
| 203 MOCK_METHOD2(OnEncryptedMediaInitData, | 207 MOCK_METHOD2(OnEncryptedMediaInitData, |
| 204 void(EmeInitDataType init_data_type, | 208 void(EmeInitDataType init_data_type, |
| 205 const std::vector<uint8_t>& init_data)); | 209 const std::vector<uint8_t>& init_data)); |
| 206 | 210 |
| 211 void OnMediaTracksUpdated(scoped_ptr<MediaTracks> tracks) {} |
| 212 |
| 207 // Accessor to demuxer internals. | 213 // Accessor to demuxer internals. |
| 208 void set_duration_known(bool duration_known) { | 214 void set_duration_known(bool duration_known) { |
| 209 demuxer_->duration_known_ = duration_known; | 215 demuxer_->duration_known_ = duration_known; |
| 210 } | 216 } |
| 211 | 217 |
| 212 bool IsStreamStopped(DemuxerStream::Type type) { | 218 bool IsStreamStopped(DemuxerStream::Type type) { |
| 213 DemuxerStream* stream = demuxer_->GetStream(type); | 219 DemuxerStream* stream = demuxer_->GetStream(type); |
| 214 CHECK(stream); | 220 CHECK(stream); |
| 215 return !static_cast<FFmpegDemuxerStream*>(stream)->demuxer_; | 221 return !static_cast<FFmpegDemuxerStream*>(stream)->demuxer_; |
| 216 } | 222 } |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 audio->Read(NewReadCB(FROM_HERE, 872, 34830, true)); | 1186 audio->Read(NewReadCB(FROM_HERE, 872, 34830, true)); |
| 1181 message_loop_.Run(); | 1187 message_loop_.Run(); |
| 1182 #else | 1188 #else |
| 1183 InitializeDemuxerAndExpectPipelineStatus(DEMUXER_ERROR_NO_SUPPORTED_STREAMS); | 1189 InitializeDemuxerAndExpectPipelineStatus(DEMUXER_ERROR_NO_SUPPORTED_STREAMS); |
| 1184 #endif | 1190 #endif |
| 1185 } | 1191 } |
| 1186 | 1192 |
| 1187 #endif // defined(USE_PROPRIETARY_CODECS) | 1193 #endif // defined(USE_PROPRIETARY_CODECS) |
| 1188 | 1194 |
| 1189 } // namespace media | 1195 } // namespace media |
| OLD | NEW |