OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chromecast/media/cma/backend/alsa/stream_mixer_alsa.h" | 5 #include "chromecast/media/cma/backend/alsa/stream_mixer_alsa.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <utility> | 10 #include <utility> |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 testing::Invoke(this, &MockInputQueue::DoGetResampledData)); | 136 testing::Invoke(this, &MockInputQueue::DoGetResampledData)); |
137 ON_CALL(*this, PrepareToDelete(_)).WillByDefault( | 137 ON_CALL(*this, PrepareToDelete(_)).WillByDefault( |
138 testing::Invoke(this, &MockInputQueue::DoPrepareToDelete)); | 138 testing::Invoke(this, &MockInputQueue::DoPrepareToDelete)); |
139 } | 139 } |
140 ~MockInputQueue() override {} | 140 ~MockInputQueue() override {} |
141 | 141 |
142 bool paused() const { return paused_; } | 142 bool paused() const { return paused_; } |
143 | 143 |
144 // StreamMixerAlsa::InputQueue implementation: | 144 // StreamMixerAlsa::InputQueue implementation: |
145 int input_samples_per_second() const override { return samples_per_second_; } | 145 int input_samples_per_second() const override { return samples_per_second_; } |
146 float volume_multiplier() const override { return multiplier_; } | |
147 bool primary() const override { return primary_; } | 146 bool primary() const override { return primary_; } |
148 bool IsDeleting() const override { return deleting_; } | 147 bool IsDeleting() const override { return deleting_; } |
149 MOCK_METHOD1(Initialize, | 148 MOCK_METHOD1(Initialize, |
150 void(const MediaPipelineBackendAlsa::RenderingDelay& | 149 void(const MediaPipelineBackendAlsa::RenderingDelay& |
151 mixer_rendering_delay)); | 150 mixer_rendering_delay)); |
152 int MaxReadSize() override { return max_read_size_; } | 151 int MaxReadSize() override { return max_read_size_; } |
153 MOCK_METHOD2(GetResampledData, void(::media::AudioBus* dest, int frames)); | 152 MOCK_METHOD2(GetResampledData, void(::media::AudioBus* dest, int frames)); |
| 153 MOCK_METHOD4( |
| 154 VolumeScaleAccumulate, |
| 155 void(bool repeat_transition, const float* src, int frames, float* dest)); |
154 MOCK_METHOD1(AfterWriteFrames, | 156 MOCK_METHOD1(AfterWriteFrames, |
155 void(const MediaPipelineBackendAlsa::RenderingDelay& | 157 void(const MediaPipelineBackendAlsa::RenderingDelay& |
156 mixer_rendering_delay)); | 158 mixer_rendering_delay)); |
157 MOCK_METHOD1(SignalError, void(StreamMixerAlsaInput::MixerError error)); | 159 MOCK_METHOD1(SignalError, void(StreamMixerAlsaInput::MixerError error)); |
158 MOCK_METHOD1(PrepareToDelete, void(const OnReadyToDeleteCb& delete_cb)); | 160 MOCK_METHOD1(PrepareToDelete, void(const OnReadyToDeleteCb& delete_cb)); |
159 | 161 |
160 // Setters and getters for test control. | 162 // Setters and getters for test control. |
161 void SetPaused(bool paused) { paused_ = paused; } | 163 void SetPaused(bool paused) { paused_ = paused; } |
162 void SetMaxReadSize(int max_read_size) { max_read_size_ = max_read_size; } | 164 void SetMaxReadSize(int max_read_size) { max_read_size_ = max_read_size; } |
163 void SetData(std::unique_ptr<::media::AudioBus> data) { | 165 void SetData(std::unique_ptr<::media::AudioBus> data) { |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 EXPECT_CALL(*inputs[0], AfterWriteFrames(_)); | 691 EXPECT_CALL(*inputs[0], AfterWriteFrames(_)); |
690 EXPECT_CALL(*inputs[1], GetResampledData(_, _)).Times(0); | 692 EXPECT_CALL(*inputs[1], GetResampledData(_, _)).Times(0); |
691 EXPECT_CALL(*inputs[1], AfterWriteFrames(_)); | 693 EXPECT_CALL(*inputs[1], AfterWriteFrames(_)); |
692 | 694 |
693 EXPECT_CALL(*mock_alsa(), PcmWritei(_, _, kNumFrames)).Times(1); | 695 EXPECT_CALL(*mock_alsa(), PcmWritei(_, _, kNumFrames)).Times(1); |
694 mixer->WriteFramesForTest(); | 696 mixer->WriteFramesForTest(); |
695 } | 697 } |
696 | 698 |
697 } // namespace media | 699 } // namespace media |
698 } // namespace chromecast | 700 } // namespace chromecast |
OLD | NEW |