OLD | NEW |
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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 ASSERT_NE(0.0f, bus->channel(0)[i]); | 747 ASSERT_NE(0.0f, bus->channel(0)[i]); |
748 } | 748 } |
749 | 749 |
750 TEST_F(AudioRendererImplTest, RenderingDelayedForSuspend) { | 750 TEST_F(AudioRendererImplTest, RenderingDelayedForSuspend) { |
751 Initialize(); | 751 Initialize(); |
752 Preroll(base::TimeDelta(), base::TimeDelta(), PIPELINE_OK); | 752 Preroll(base::TimeDelta(), base::TimeDelta(), PIPELINE_OK); |
753 StartTicking(); | 753 StartTicking(); |
754 | 754 |
755 // Verify the first buffer is real data. | 755 // Verify the first buffer is real data. |
756 int frames_read = 0; | 756 int frames_read = 0; |
757 std::unique_ptr<AudioBus> bus = AudioBus::Create(hardware_params_); | 757 std::unique_ptr<AudioBus> bus = |
| 758 AudioBus::Create(hardware_config_.GetOutputConfig()); |
758 EXPECT_TRUE(sink_->Render(bus.get(), 0, &frames_read)); | 759 EXPECT_TRUE(sink_->Render(bus.get(), 0, &frames_read)); |
759 EXPECT_NE(0, frames_read); | 760 EXPECT_NE(0, frames_read); |
760 for (int i = 0; i < bus->frames(); ++i) | 761 for (int i = 0; i < bus->frames(); ++i) |
761 ASSERT_NE(0.0f, bus->channel(0)[i]); | 762 ASSERT_NE(0.0f, bus->channel(0)[i]); |
762 | 763 |
763 // Verify after suspend we get silence. | 764 // Verify after suspend we get silence. |
764 renderer_->OnSuspend(); | 765 renderer_->OnSuspend(); |
765 EXPECT_TRUE(sink_->Render(bus.get(), 0, &frames_read)); | 766 EXPECT_TRUE(sink_->Render(bus.get(), 0, &frames_read)); |
766 EXPECT_EQ(0, frames_read); | 767 EXPECT_EQ(0, frames_read); |
767 | 768 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 // Advance far enough that we shouldn't be clamped to current time (tested | 979 // Advance far enough that we shouldn't be clamped to current time (tested |
979 // already above). | 980 // already above). |
980 tick_clock_->Advance(kOneSecond); | 981 tick_clock_->Advance(kOneSecond); |
981 EXPECT_EQ( | 982 EXPECT_EQ( |
982 current_time + timestamp_helper.GetFrameDuration(frames_to_consume.value), | 983 current_time + timestamp_helper.GetFrameDuration(frames_to_consume.value), |
983 CurrentMediaWallClockTime(&is_time_moving)); | 984 CurrentMediaWallClockTime(&is_time_moving)); |
984 EXPECT_TRUE(is_time_moving); | 985 EXPECT_TRUE(is_time_moving); |
985 } | 986 } |
986 | 987 |
987 } // namespace media | 988 } // namespace media |
OLD | NEW |