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

Side by Side Diff: media/renderers/audio_renderer_impl_unittest.cc

Issue 2472183004: [TO 54] AudioRendererImpl: Don't advance time when rendering stops. (Closed)
Patch Set: Created 4 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
OLDNEW
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 "media/renderers/audio_renderer_impl.h" 5 #include "media/renderers/audio_renderer_impl.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 EXPECT_TRUE(ConsumeBufferedData(frames_to_consume, 1)); 748 EXPECT_TRUE(ConsumeBufferedData(frames_to_consume, 1));
749 749
750 // Current time should never go backwards even for irregular OS callbacks and 750 // Current time should never go backwards even for irregular OS callbacks and
751 // those with odd / wrong delay values. 751 // those with odd / wrong delay values.
752 EXPECT_EQ(last_media_time, CurrentMediaTime()); 752 EXPECT_EQ(last_media_time, CurrentMediaTime());
753 753
754 // Stop ticking, the media time should be clamped to what's been rendered. 754 // Stop ticking, the media time should be clamped to what's been rendered.
755 StopTicking(); 755 StopTicking();
756 EXPECT_EQ(timestamp_helper.GetTimestamp(), CurrentMediaTime()); 756 EXPECT_EQ(timestamp_helper.GetTimestamp(), CurrentMediaTime());
757 tick_clock_->Advance(kConsumptionDuration * 2); 757 tick_clock_->Advance(kConsumptionDuration * 2);
758 timestamp_helper.AddFrames(frames_to_consume.value); 758
759 // TODO(chcunningham): Uncomment the AddFrames() call below. AudioClock should
760 // be expected to advance time through the last rendered buffer's samples, but
761 // we've currently capped it to not advance time after ticking stops as a
762 // short term workaround for messy blink code. See longterm solution at
763 // http://crrev.com/2425463002.
764 // timestamp_helper.AddFrames(frames_to_consume.value);
759 EXPECT_EQ(timestamp_helper.GetTimestamp(), CurrentMediaTime()); 765 EXPECT_EQ(timestamp_helper.GetTimestamp(), CurrentMediaTime());
760 } 766 }
761 767
762 TEST_F(AudioRendererImplTest, RenderingDelayedForEarlyStartTime) { 768 TEST_F(AudioRendererImplTest, RenderingDelayedForEarlyStartTime) {
763 Initialize(); 769 Initialize();
764 770
765 // Choose a first timestamp a few buffers into the future, which ends halfway 771 // Choose a first timestamp a few buffers into the future, which ends halfway
766 // through the desired output buffer; this allows for maximum test coverage. 772 // through the desired output buffer; this allows for maximum test coverage.
767 const double kBuffers = 4.5; 773 const double kBuffers = 4.5;
768 const base::TimeDelta first_timestamp = 774 const base::TimeDelta first_timestamp =
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 // Advance far enough that we shouldn't be clamped to current time (tested 1033 // Advance far enough that we shouldn't be clamped to current time (tested
1028 // already above). 1034 // already above).
1029 tick_clock_->Advance(kOneSecond); 1035 tick_clock_->Advance(kOneSecond);
1030 EXPECT_EQ( 1036 EXPECT_EQ(
1031 current_time + timestamp_helper.GetFrameDuration(frames_to_consume.value), 1037 current_time + timestamp_helper.GetFrameDuration(frames_to_consume.value),
1032 CurrentMediaWallClockTime(&is_time_moving)); 1038 CurrentMediaWallClockTime(&is_time_moving));
1033 EXPECT_TRUE(is_time_moving); 1039 EXPECT_TRUE(is_time_moving);
1034 } 1040 }
1035 1041
1036 } // namespace media 1042 } // namespace media
OLDNEW
« no previous file with comments | « media/renderers/audio_renderer_impl.cc ('k') | third_party/WebKit/LayoutTests/http/tests/media/video-play-stall.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698