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

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

Issue 215783002: Fix an issue that audio and video may run out of sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing comments Created 6 years, 8 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
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/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 // player has not yet received media crypto. 2057 // player has not yet received media crypto.
2058 DemuxerConfigs configs = CreateVideoDemuxerConfigs(); 2058 DemuxerConfigs configs = CreateVideoDemuxerConfigs();
2059 configs.is_video_encrypted = true; 2059 configs.is_video_encrypted = true;
2060 2060
2061 player_.OnDemuxerConfigsAvailable(configs); 2061 player_.OnDemuxerConfigsAvailable(configs);
2062 CreateNextTextureAndSetVideoSurface(); 2062 CreateNextTextureAndSetVideoSurface();
2063 EXPECT_FALSE(IsPendingSurfaceChange()); 2063 EXPECT_FALSE(IsPendingSurfaceChange());
2064 EXPECT_FALSE(GetMediaDecoderJob(false)); 2064 EXPECT_FALSE(GetMediaDecoderJob(false));
2065 } 2065 }
2066 2066
2067 TEST_F(MediaSourcePlayerTest, CurrentTimeUpdatedWhileDecoderStarved) {
wolenetz 2014/04/03 18:14:40 Does this one test cover all 3 items in this CL's
qinmin 2014/04/03 21:59:45 This covers the first item in the description. I a
2068 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE();
2069
2070 // Test that current time is updated while decoder is starved.
2071 StartAudioDecoderJob(true);
2072 for (int i = 0; i < 3; ++i) {
2073 player_.OnDemuxerDataAvailable(CreateReadFromDemuxerAckForAudio(i));
2074 WaitForAudioDecodeDone();
2075 }
2076 base::TimeDelta current_time = player_.GetCurrentTime();
2077
2078 // Trigger starvation while the decoder is decoding.
2079 player_.OnDemuxerDataAvailable(CreateReadFromDemuxerAckForAudio(3));
2080 TriggerPlayerStarvation();
2081 WaitForAudioDecodeDone();
2082
2083 // Current time should be updated.
2084 EXPECT_LT(current_time.InMillisecondsF(),
2085 player_.GetCurrentTime().InMillisecondsF());
2086 }
2087
2067 } // namespace media 2088 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698