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

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

Issue 2423903003: AudioRendererImpl: Don't advance time when rendering stops. (Closed)
Patch Set: feedback Created 4 years, 2 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
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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 tick_clock_->Advance(kConsumptionDuration * 2); 741 tick_clock_->Advance(kConsumptionDuration * 2);
742 EXPECT_EQ(timestamp_helper.GetTimestamp(), CurrentMediaTime()); 742 EXPECT_EQ(timestamp_helper.GetTimestamp(), CurrentMediaTime());
743 743
744 // Consume some more audio data. 744 // Consume some more audio data.
745 EXPECT_TRUE(ConsumeBufferedData(frames_to_consume)); 745 EXPECT_TRUE(ConsumeBufferedData(frames_to_consume));
746 746
747 // Stop ticking, the media time should be clamped to what's been rendered. 747 // Stop ticking, the media time should be clamped to what's been rendered.
748 StopTicking(); 748 StopTicking();
749 EXPECT_EQ(timestamp_helper.GetTimestamp(), CurrentMediaTime()); 749 EXPECT_EQ(timestamp_helper.GetTimestamp(), CurrentMediaTime());
750 tick_clock_->Advance(kConsumptionDuration * 2); 750 tick_clock_->Advance(kConsumptionDuration * 2);
751 timestamp_helper.AddFrames(frames_to_consume.value); 751
752 // TODO(chcunningham): Uncomment the AddFrames() call below. AudioClock should
753 // be expected to advance time through the last rendered buffer's samples, but
754 // we've currently capped it to not advance time after ticking stops as a
755 // short term workaround for messy blink code. See longterm solution at
756 // http://crrev.com/2425463002.
757 // timestamp_helper.AddFrames(frames_to_consume.value);
752 EXPECT_EQ(timestamp_helper.GetTimestamp(), CurrentMediaTime()); 758 EXPECT_EQ(timestamp_helper.GetTimestamp(), CurrentMediaTime());
753 } 759 }
754 760
755 TEST_F(AudioRendererImplTest, RenderingDelayedForEarlyStartTime) { 761 TEST_F(AudioRendererImplTest, RenderingDelayedForEarlyStartTime) {
756 Initialize(); 762 Initialize();
757 763
758 // Choose a first timestamp a few buffers into the future, which ends halfway 764 // Choose a first timestamp a few buffers into the future, which ends halfway
759 // through the desired output buffer; this allows for maximum test coverage. 765 // through the desired output buffer; this allows for maximum test coverage.
760 const double kBuffers = 4.5; 766 const double kBuffers = 4.5;
761 const base::TimeDelta first_timestamp = 767 const base::TimeDelta first_timestamp =
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 // Advance far enough that we shouldn't be clamped to current time (tested 1026 // Advance far enough that we shouldn't be clamped to current time (tested
1021 // already above). 1027 // already above).
1022 tick_clock_->Advance(kOneSecond); 1028 tick_clock_->Advance(kOneSecond);
1023 EXPECT_EQ( 1029 EXPECT_EQ(
1024 current_time + timestamp_helper.GetFrameDuration(frames_to_consume.value), 1030 current_time + timestamp_helper.GetFrameDuration(frames_to_consume.value),
1025 CurrentMediaWallClockTime(&is_time_moving)); 1031 CurrentMediaWallClockTime(&is_time_moving));
1026 EXPECT_TRUE(is_time_moving); 1032 EXPECT_TRUE(is_time_moving);
1027 } 1033 }
1028 1034
1029 } // namespace media 1035 } // 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