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

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

Issue 171233007: Don't process pending prefetch events if we fail to create video decoder job (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months 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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 EXPECT_EQ(1, demuxer_->num_data_requests()); 879 EXPECT_EQ(1, demuxer_->num_data_requests());
880 880
881 // Simulate browser seek is done and confirm player requests more data for new 881 // Simulate browser seek is done and confirm player requests more data for new
882 // video decoder job. 882 // video decoder job.
883 player_.OnDemuxerSeekDone(player_.GetCurrentTime()); 883 player_.OnDemuxerSeekDone(player_.GetCurrentTime());
884 EXPECT_TRUE(GetMediaDecoderJob(false)); 884 EXPECT_TRUE(GetMediaDecoderJob(false));
885 EXPECT_EQ(2, demuxer_->num_data_requests()); 885 EXPECT_EQ(2, demuxer_->num_data_requests());
886 EXPECT_EQ(1, demuxer_->num_seek_requests()); 886 EXPECT_EQ(1, demuxer_->num_seek_requests());
887 } 887 }
888 888
889 TEST_F(MediaSourcePlayerTest, SetEmptySurfaceWhileDecoding) {
890 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE();
891
892 // Test player pauses if an empty surface is passed.
893 CreateNextTextureAndSetVideoSurface();
894 StartVideoDecoderJob(true);
895
896 // Send the first input chunk.
897 player_.OnDemuxerDataAvailable(CreateReadFromDemuxerAckForVideo());
898
899 // While the decoder is decoding, pass an empty surface.
900 gfx::ScopedJavaSurface empty_surface;
901 player_.SetVideoSurface(empty_surface.Pass());
wolenetz 2014/02/20 20:52:11 Is this where the NPE previously occurred prior to
qinmin 2014/02/20 22:36:05 Added a TriggerPlayerStarvation() call to let the
902
903 // Wait for the decoder job to finish decoding and be reset.
904 while (GetMediaDecoderJob(false))
905 message_loop_.RunUntilIdle();
906
907 // No seek request should have been received since the surface is empty.
908 EXPECT_EQ(0, demuxer_->num_browser_seek_requests());
909
910 // Playback resumes once a non-empty surface is passed.
911 CreateNextTextureAndSetVideoSurface();
912 EXPECT_EQ(1, demuxer_->num_browser_seek_requests());
913 }
914
889 TEST_F(MediaSourcePlayerTest, AudioOnlyStartAfterSeekFinish) { 915 TEST_F(MediaSourcePlayerTest, AudioOnlyStartAfterSeekFinish) {
890 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); 916 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE();
891 917
892 // Test audio decoder job will not start until pending seek event is handled. 918 // Test audio decoder job will not start until pending seek event is handled.
893 DemuxerConfigs configs = CreateAudioDemuxerConfigs(kCodecVorbis); 919 DemuxerConfigs configs = CreateAudioDemuxerConfigs(kCodecVorbis);
894 player_.OnDemuxerConfigsAvailable(configs); 920 player_.OnDemuxerConfigsAvailable(configs);
895 EXPECT_FALSE(GetMediaDecoderJob(true)); 921 EXPECT_FALSE(GetMediaDecoderJob(true));
896 922
897 // Initiate a seek. Skip requesting element seek of renderer. 923 // Initiate a seek. Skip requesting element seek of renderer.
898 // Instead behave as if the renderer has asked us to seek. 924 // Instead behave as if the renderer has asked us to seek.
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after
2063 2089
2064 std::vector<std::string> codec_avc(1, "avc1"); 2090 std::vector<std::string> codec_avc(1, "avc1");
2065 EXPECT_FALSE(IsTypeSupported(invalid_uuid, kL3, kVideoMp4, codec_avc)); 2091 EXPECT_FALSE(IsTypeSupported(invalid_uuid, kL3, kVideoMp4, codec_avc));
2066 EXPECT_FALSE(IsTypeSupported(invalid_uuid, kL1, kVideoMp4, codec_avc)); 2092 EXPECT_FALSE(IsTypeSupported(invalid_uuid, kL1, kVideoMp4, codec_avc));
2067 } 2093 }
2068 2094
2069 // TODO(xhwang): Are these IsTypeSupported tests device specific? 2095 // TODO(xhwang): Are these IsTypeSupported tests device specific?
2070 // TODO(xhwang): Add more IsTypeSupported tests. 2096 // TODO(xhwang): Add more IsTypeSupported tests.
2071 2097
2072 } // namespace media 2098 } // 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