Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: media/base/android/media_source_player_unittest.cc

Issue 53413004: Clear any pending surface change prior to checking media crypto in MSP::ConfigureVideoDecoderJob() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/android/media_source_player.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // prefetch done event is cleared across |player_|'s Release(). This helps 201 // prefetch done event is cleared across |player_|'s Release(). This helps
202 // ensure the ReleaseWithOnPrefetchDoneAlreadyPosted test scenario is met. 202 // ensure the ReleaseWithOnPrefetchDoneAlreadyPosted test scenario is met.
203 void ReleaseWithPendingPrefetchDoneVerification() { 203 void ReleaseWithPendingPrefetchDoneVerification() {
204 EXPECT_TRUE(player_.IsEventPending(player_.PREFETCH_DONE_EVENT_PENDING)); 204 EXPECT_TRUE(player_.IsEventPending(player_.PREFETCH_DONE_EVENT_PENDING));
205 ReleasePlayer(); 205 ReleasePlayer();
206 EXPECT_FALSE(player_.IsEventPending(player_.PREFETCH_DONE_EVENT_PENDING)); 206 EXPECT_FALSE(player_.IsEventPending(player_.PREFETCH_DONE_EVENT_PENDING));
207 EXPECT_FALSE(decoder_callback_hook_executed_); 207 EXPECT_FALSE(decoder_callback_hook_executed_);
208 decoder_callback_hook_executed_ = true; 208 decoder_callback_hook_executed_ = true;
209 } 209 }
210 210
211 // Inspect internal pending_event_ state of |player_|. This is for infrequent
212 // use by tests, only where required.
213 bool IsPendingSurfaceChange() {
214 return player_.IsEventPending(player_.SURFACE_CHANGE_EVENT_PENDING);
215 }
216
211 DemuxerConfigs CreateAudioDemuxerConfigs() { 217 DemuxerConfigs CreateAudioDemuxerConfigs() {
212 DemuxerConfigs configs; 218 DemuxerConfigs configs;
213 configs.audio_codec = kCodecVorbis; 219 configs.audio_codec = kCodecVorbis;
214 configs.audio_channels = 2; 220 configs.audio_channels = 2;
215 configs.audio_sampling_rate = 44100; 221 configs.audio_sampling_rate = 44100;
216 configs.is_audio_encrypted = false; 222 configs.is_audio_encrypted = false;
217 configs.duration_ms = kDefaultDurationInMs; 223 configs.duration_ms = kDefaultDurationInMs;
218 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile("vorbis-extradata"); 224 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile("vorbis-extradata");
219 configs.audio_extra_data = std::vector<uint8>( 225 configs.audio_extra_data = std::vector<uint8>(
220 buffer->data(), 226 buffer->data(),
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 EXPECT_TRUE(GetMediaDecoderJob(false)); 1707 EXPECT_TRUE(GetMediaDecoderJob(false));
1702 EXPECT_TRUE(IsPrerolling(false)); 1708 EXPECT_TRUE(IsPrerolling(false));
1703 EXPECT_EQ(expected_preroll_timestamp, GetPrerollTimestamp()); 1709 EXPECT_EQ(expected_preroll_timestamp, GetPrerollTimestamp());
1704 EXPECT_EQ(expected_preroll_timestamp, player_.GetCurrentTime()); 1710 EXPECT_EQ(expected_preroll_timestamp, player_.GetCurrentTime());
1705 EXPECT_EQ(2, demuxer_->num_data_requests()); 1711 EXPECT_EQ(2, demuxer_->num_data_requests());
1706 1712
1707 // No further seek should have been requested since BrowserSeekPlayer(). 1713 // No further seek should have been requested since BrowserSeekPlayer().
1708 EXPECT_EQ(1, demuxer_->num_seek_requests()); 1714 EXPECT_EQ(1, demuxer_->num_seek_requests());
1709 } 1715 }
1710 1716
1717 // TODO(xhwang): Once we add tests to cover DrmBridge, update this test to
1718 // also verify that the job is successfully created if SetDrmBridge(), Start()
1719 // and eventually OnMediaCrypto() occur. This would increase test coverage of
1720 // http://crbug.com/313470 and allow us to remove inspection of internal player
1721 // pending event state. See http://crbug.com/313860.
1722 TEST_F(MediaSourcePlayerTest, SurfaceChangeClearedEvenIfMediaCryptoAbsent) {
1723 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE();
1724
1725 // Test that |SURFACE_CHANGE_EVENT_PENDING| is not pending after
1726 // SetVideoSurface() for a player configured for encrypted video, when the
1727 // player has not yet received media crypto.
1728 DemuxerConfigs configs = CreateVideoDemuxerConfigs();
1729 configs.is_video_encrypted = true;
1730
1731 player_.OnDemuxerConfigsAvailable(configs);
1732 CreateNextTextureAndSetVideoSurface();
1733 EXPECT_FALSE(IsPendingSurfaceChange());
1734 EXPECT_FALSE(GetMediaDecoderJob(false));
1735 }
1736
1711 // TODO(xhwang): Enable this test when the test devices are updated. 1737 // TODO(xhwang): Enable this test when the test devices are updated.
1712 TEST_F(MediaSourcePlayerTest, DISABLED_IsTypeSupported_Widevine) { 1738 TEST_F(MediaSourcePlayerTest, DISABLED_IsTypeSupported_Widevine) {
1713 if (!MediaCodecBridge::IsAvailable() || !MediaDrmBridge::IsAvailable()) { 1739 if (!MediaCodecBridge::IsAvailable() || !MediaDrmBridge::IsAvailable()) {
1714 LOG(INFO) << "Could not run test - not supported on device."; 1740 LOG(INFO) << "Could not run test - not supported on device.";
1715 return; 1741 return;
1716 } 1742 }
1717 1743
1718 uint8 kWidevineUUID[] = { 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE, 1744 uint8 kWidevineUUID[] = { 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE,
1719 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED }; 1745 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED };
1720 1746
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 1801
1776 std::vector<std::string> codec_avc(1, "avc1"); 1802 std::vector<std::string> codec_avc(1, "avc1");
1777 EXPECT_FALSE(IsTypeSupported(invalid_uuid, "L3", kVideoMp4, codec_avc)); 1803 EXPECT_FALSE(IsTypeSupported(invalid_uuid, "L3", kVideoMp4, codec_avc));
1778 EXPECT_FALSE(IsTypeSupported(invalid_uuid, "L1", kVideoMp4, codec_avc)); 1804 EXPECT_FALSE(IsTypeSupported(invalid_uuid, "L1", kVideoMp4, codec_avc));
1779 } 1805 }
1780 1806
1781 // TODO(xhwang): Are these IsTypeSupported tests device specific? 1807 // TODO(xhwang): Are these IsTypeSupported tests device specific?
1782 // TODO(xhwang): Add more IsTypeSupported tests. 1808 // TODO(xhwang): Add more IsTypeSupported tests.
1783 1809
1784 } // namespace media 1810 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_source_player.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698