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

Unified Diff: media/renderers/audio_renderer_impl_unittest.cc

Issue 1942803002: Caching AudioOutputDevice instances in mixer manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make WebAudioSourceProvider to always return real sink info reguardless the client - to avoid behavior change. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/renderers/audio_renderer_impl.cc ('k') | media/renderers/default_renderer_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/renderers/audio_renderer_impl_unittest.cc
diff --git a/media/renderers/audio_renderer_impl_unittest.cc b/media/renderers/audio_renderer_impl_unittest.cc
index ce199235950578ce942d218e500d7fccc580b3f4..b00d590585b03b6675af6cd19293b79c3fdc7d48 100644
--- a/media/renderers/audio_renderer_impl_unittest.cc
+++ b/media/renderers/audio_renderer_impl_unittest.cc
@@ -15,7 +15,6 @@
#include "base/strings/stringprintf.h"
#include "base/test/simple_test_tick_clock.h"
#include "media/base/audio_buffer_converter.h"
-#include "media/base/audio_hardware_config.h"
#include "media/base/audio_splicer.h"
#include "media/base/fake_audio_renderer_sink.h"
#include "media/base/gmock_callback_support.h"
@@ -69,7 +68,12 @@ class AudioRendererImplTest : public ::testing::Test, public RendererClient {
public:
// Give the decoder some non-garbage media properties.
AudioRendererImplTest()
- : hardware_config_(AudioParameters(), AudioParameters()),
+ : hardware_params_(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ kChannelLayout,
+ kOutputSamplesPerSecond,
+ SampleFormatToBytesPerChannel(kSampleFormat) * 8,
+ 512),
+ sink_(new FakeAudioRendererSink(hardware_params_)),
tick_clock_(new base::SimpleTestTickClock()),
demuxer_stream_(DemuxerStream::AUDIO),
decoder_(new MockAudioDecoder()),
@@ -96,13 +100,11 @@ class AudioRendererImplTest : public ::testing::Test, public RendererClient {
kOutputSamplesPerSecond,
SampleFormatToBytesPerChannel(kSampleFormat) * 8,
512);
- hardware_config_.UpdateOutputConfig(out_params);
ScopedVector<AudioDecoder> decoders;
decoders.push_back(decoder_);
- sink_ = new FakeAudioRendererSink();
renderer_.reset(new AudioRendererImpl(message_loop_.task_runner(),
sink_.get(), std::move(decoders),
- hardware_config_, new MediaLog()));
+ new MediaLog()));
renderer_->tick_clock_.reset(tick_clock_);
tick_clock_->Advance(base::TimeDelta::FromSeconds(1));
}
@@ -362,10 +364,10 @@ class AudioRendererImplTest : public ::testing::Test, public RendererClient {
bool ended() const { return ended_; }
// Fixture members.
+ AudioParameters hardware_params_;
base::MessageLoop message_loop_;
std::unique_ptr<AudioRendererImpl> renderer_;
scoped_refptr<FakeAudioRendererSink> sink_;
- AudioHardwareConfig hardware_config_;
base::SimpleTestTickClock* tick_clock_;
PipelineStatistics last_statistics_;
@@ -715,16 +717,15 @@ TEST_F(AudioRendererImplTest, RenderingDelayedForEarlyStartTime) {
// Choose a first timestamp a few buffers into the future, which ends halfway
// through the desired output buffer; this allows for maximum test coverage.
const double kBuffers = 4.5;
- const base::TimeDelta first_timestamp = base::TimeDelta::FromSecondsD(
- hardware_config_.GetOutputBufferSize() * kBuffers /
- hardware_config_.GetOutputSampleRate());
+ const base::TimeDelta first_timestamp =
+ base::TimeDelta::FromSecondsD(hardware_params_.frames_per_buffer() *
+ kBuffers / hardware_params_.sample_rate());
Preroll(base::TimeDelta(), first_timestamp, PIPELINE_OK);
StartTicking();
// Verify the first few buffers are silent.
- std::unique_ptr<AudioBus> bus =
- AudioBus::Create(hardware_config_.GetOutputConfig());
+ std::unique_ptr<AudioBus> bus = AudioBus::Create(hardware_params_);
int frames_read = 0;
for (int i = 0; i < std::floor(kBuffers); ++i) {
EXPECT_TRUE(sink_->Render(bus.get(), 0, &frames_read));
« no previous file with comments | « media/renderers/audio_renderer_impl.cc ('k') | media/renderers/default_renderer_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698