| Index: chromecast/media/cma/backend/alsa/stream_mixer_alsa_unittest.cc
|
| diff --git a/chromecast/media/cma/backend/alsa/stream_mixer_alsa_unittest.cc b/chromecast/media/cma/backend/alsa/stream_mixer_alsa_unittest.cc
|
| index db5e3421bb6a6df36c083dd7299f3cf37db9b3f4..9770a4c023129252ec0b7905f128f33fb914b9e7 100644
|
| --- a/chromecast/media/cma/backend/alsa/stream_mixer_alsa_unittest.cc
|
| +++ b/chromecast/media/cma/backend/alsa/stream_mixer_alsa_unittest.cc
|
| @@ -15,7 +15,6 @@
|
| #include "base/run_loop.h"
|
| #include "base/threading/thread_task_runner_handle.h"
|
| #include "chromecast/media/cma/backend/alsa/mock_alsa_wrapper.h"
|
| -#include "media/audio/audio_device_description.h"
|
| #include "media/base/audio_bus.h"
|
| #include "media/base/vector_math.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| @@ -127,17 +126,13 @@
|
|
|
| class MockInputQueue : public StreamMixerAlsa::InputQueue {
|
| public:
|
| - explicit MockInputQueue(int samples_per_second,
|
| - const std::string& device_id =
|
| - ::media::AudioDeviceDescription::kDefaultDeviceId)
|
| + explicit MockInputQueue(int samples_per_second)
|
| : paused_(true),
|
| samples_per_second_(samples_per_second),
|
| max_read_size_(kTestMaxReadSize),
|
| multiplier_(1.0),
|
| primary_(true),
|
| - deleting_(false),
|
| - device_id_(device_id),
|
| - filter_group_(nullptr) {
|
| + deleting_(false) {
|
| ON_CALL(*this, GetResampledData(_, _)).WillByDefault(
|
| testing::Invoke(this, &MockInputQueue::DoGetResampledData));
|
| ON_CALL(*this, VolumeScaleAccumulate(_, _, _, _)).WillByDefault(
|
| @@ -156,9 +151,6 @@
|
| MOCK_METHOD1(Initialize,
|
| void(const MediaPipelineBackendAlsa::RenderingDelay&
|
| mixer_rendering_delay));
|
| - std::string device_id() const override { return device_id_; }
|
| - void set_filter_group(FilterGroup* group) override { filter_group_ = group; }
|
| - FilterGroup* filter_group() override { return filter_group_; }
|
| int MaxReadSize() override { return max_read_size_; }
|
| MOCK_METHOD2(GetResampledData, void(::media::AudioBus* dest, int frames));
|
| MOCK_METHOD4(
|
| @@ -222,9 +214,6 @@
|
| float multiplier_;
|
| bool primary_;
|
| bool deleting_;
|
| - const std::string device_id_;
|
| - FilterGroup* filter_group_;
|
| -
|
| std::unique_ptr<::media::AudioBus> data_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(MockInputQueue);
|
| @@ -499,48 +488,6 @@
|
| new testing::StrictMock<MockInputQueue>(kTestSamplesPerSecond));
|
| inputs.back()->SetPaused(false);
|
| }
|
| -
|
| - StreamMixerAlsa* mixer = StreamMixerAlsa::Get();
|
| - for (size_t i = 0; i < inputs.size(); ++i) {
|
| - EXPECT_CALL(*inputs[i], Initialize(_)).Times(1);
|
| - mixer->AddInput(base::WrapUnique(inputs[i]));
|
| - }
|
| -
|
| - // Poll the inputs for data.
|
| - const int kNumFrames = 32;
|
| - for (size_t i = 0; i < inputs.size(); ++i) {
|
| - inputs[i]->SetData(GetTestData(i));
|
| - EXPECT_CALL(*inputs[i], GetResampledData(_, kNumFrames));
|
| - EXPECT_CALL(*inputs[i], VolumeScaleAccumulate(_, _, kNumFrames, _))
|
| - .Times(kNumChannels);
|
| - EXPECT_CALL(*inputs[i], AfterWriteFrames(_));
|
| - }
|
| -
|
| - EXPECT_CALL(*mock_alsa(), PcmWritei(_, _, kNumFrames)).Times(1);
|
| - mixer->WriteFramesForTest();
|
| -
|
| - // Mix the inputs manually.
|
| - auto expected = GetMixedAudioData(inputs);
|
| -
|
| - // Get the actual stream rendered to ALSA, and compare it against the
|
| - // expected stream. The stream should match exactly.
|
| - auto actual = ::media::AudioBus::Create(kNumChannels, kNumFrames);
|
| - actual->FromInterleaved(&(mock_alsa()->data()[0]), kNumFrames,
|
| - kBytesPerSample);
|
| - CompareAudioData(*expected, *actual);
|
| -}
|
| -
|
| -TEST_F(StreamMixerAlsaTest, TwoUnscaledStreamsWithDifferentIdsMixProperly) {
|
| - // Create a group of input streams.
|
| - std::vector<testing::StrictMock<MockInputQueue>*> inputs;
|
| - inputs.push_back(new testing::StrictMock<MockInputQueue>(
|
| - kTestSamplesPerSecond,
|
| - ::media::AudioDeviceDescription::kDefaultDeviceId));
|
| - inputs.back()->SetPaused(false);
|
| - inputs.push_back(new testing::StrictMock<MockInputQueue>(
|
| - kTestSamplesPerSecond,
|
| - ::media::AudioDeviceDescription::kCommunicationsDeviceId));
|
| - inputs.back()->SetPaused(false);
|
|
|
| StreamMixerAlsa* mixer = StreamMixerAlsa::Get();
|
| for (size_t i = 0; i < inputs.size(); ++i) {
|
|
|