OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "media/base/android/media_codec_bridge.h" | 10 #include "media/base/android/media_codec_bridge.h" |
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 | 1265 |
1266 // Send data after the seek position. | 1266 // Send data after the seek position. |
1267 data = CreateReadFromDemuxerAckForAudio(3); | 1267 data = CreateReadFromDemuxerAckForAudio(3); |
1268 data.access_units[0].timestamp = base::TimeDelta::FromMilliseconds(100); | 1268 data.access_units[0].timestamp = base::TimeDelta::FromMilliseconds(100); |
1269 player_.OnDemuxerDataAvailable(data); | 1269 player_.OnDemuxerDataAvailable(data); |
1270 message_loop_.Run(); | 1270 message_loop_.Run(); |
1271 EXPECT_LT(100.0, player_.GetCurrentTime().InMillisecondsF()); | 1271 EXPECT_LT(100.0, player_.GetCurrentTime().InMillisecondsF()); |
1272 EXPECT_FALSE(IsPrerolling(true)); | 1272 EXPECT_FALSE(IsPrerolling(true)); |
1273 } | 1273 } |
1274 | 1274 |
| 1275 TEST_F(MediaSourcePlayerTest, SimultaneousAudioVideoConfigChange) { |
| 1276 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); |
| 1277 |
| 1278 // Test that the player allows simultaneous audio and video config change, |
| 1279 // such as might occur during OnPrefetchDone() if next access unit for both |
| 1280 // audio and video jobs is |kConfigChanged|. |
| 1281 Start(CreateAudioVideoDemuxerConfigs()); |
| 1282 CreateNextTextureAndSetVideoSurface(); |
| 1283 MediaDecoderJob* first_audio_job = GetMediaDecoderJob(true); |
| 1284 MediaDecoderJob* first_video_job = GetMediaDecoderJob(false); |
| 1285 EXPECT_TRUE(first_audio_job && first_video_job); |
| 1286 |
| 1287 // Simulate audio |kConfigChanged| prefetched as standalone access unit. |
| 1288 player_.OnDemuxerDataAvailable( |
| 1289 CreateReadFromDemuxerAckWithConfigChanged(true, 0)); |
| 1290 EXPECT_EQ(0, demuxer_->num_config_requests()); // No OnPrefetchDone() yet. |
| 1291 |
| 1292 // Simulate video |kConfigChanged| prefetched as standalone access unit. |
| 1293 player_.OnDemuxerDataAvailable( |
| 1294 CreateReadFromDemuxerAckWithConfigChanged(false, 0)); |
| 1295 EXPECT_EQ(1, demuxer_->num_config_requests()); // OnPrefetchDone() occurred. |
| 1296 EXPECT_EQ(2, demuxer_->num_data_requests()); |
| 1297 |
| 1298 // No job re-creation should occur until the requested configs arrive. |
| 1299 EXPECT_EQ(first_audio_job, GetMediaDecoderJob(true)); |
| 1300 EXPECT_EQ(first_video_job, GetMediaDecoderJob(false)); |
| 1301 |
| 1302 player_.OnDemuxerConfigsAvailable(CreateAudioVideoDemuxerConfigs()); |
| 1303 EXPECT_EQ(4, demuxer_->num_data_requests()); |
| 1304 MediaDecoderJob* second_audio_job = GetMediaDecoderJob(true); |
| 1305 MediaDecoderJob* second_video_job = GetMediaDecoderJob(false); |
| 1306 EXPECT_NE(first_audio_job, second_audio_job); |
| 1307 EXPECT_NE(first_video_job, second_video_job); |
| 1308 EXPECT_TRUE(second_audio_job && second_video_job); |
| 1309 |
| 1310 // Confirm no further demuxer configs requested. |
| 1311 EXPECT_EQ(1, demuxer_->num_config_requests()); |
| 1312 } |
| 1313 |
1275 TEST_F(MediaSourcePlayerTest, DemuxerConfigRequestedIfInPrefetchUnit0) { | 1314 TEST_F(MediaSourcePlayerTest, DemuxerConfigRequestedIfInPrefetchUnit0) { |
1276 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); | 1315 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); |
1277 | 1316 |
1278 // Test that the player detects need for and requests demuxer configs if | 1317 // Test that the player detects need for and requests demuxer configs if |
1279 // the |kConfigChanged| unit is the very first unit in the set of units | 1318 // the |kConfigChanged| unit is the very first unit in the set of units |
1280 // received in OnDemuxerDataAvailable() ostensibly while | 1319 // received in OnDemuxerDataAvailable() ostensibly while |
1281 // |PREFETCH_DONE_EVENT_PENDING|. | 1320 // |PREFETCH_DONE_EVENT_PENDING|. |
1282 StartConfigChange(true, true, 0); | 1321 StartConfigChange(true, true, 0); |
1283 } | 1322 } |
1284 | 1323 |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 | 1814 |
1776 std::vector<std::string> codec_avc(1, "avc1"); | 1815 std::vector<std::string> codec_avc(1, "avc1"); |
1777 EXPECT_FALSE(IsTypeSupported(invalid_uuid, "L3", kVideoMp4, codec_avc)); | 1816 EXPECT_FALSE(IsTypeSupported(invalid_uuid, "L3", kVideoMp4, codec_avc)); |
1778 EXPECT_FALSE(IsTypeSupported(invalid_uuid, "L1", kVideoMp4, codec_avc)); | 1817 EXPECT_FALSE(IsTypeSupported(invalid_uuid, "L1", kVideoMp4, codec_avc)); |
1779 } | 1818 } |
1780 | 1819 |
1781 // TODO(xhwang): Are these IsTypeSupported tests device specific? | 1820 // TODO(xhwang): Are these IsTypeSupported tests device specific? |
1782 // TODO(xhwang): Add more IsTypeSupported tests. | 1821 // TODO(xhwang): Add more IsTypeSupported tests. |
1783 | 1822 |
1784 } // namespace media | 1823 } // namespace media |
OLD | NEW |