| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 bool paused() const { return paused_; } | 150 bool paused() const { return paused_; } |
| 151 | 151 |
| 152 // StreamMixerAlsa::InputQueue implementation: | 152 // StreamMixerAlsa::InputQueue implementation: |
| 153 int input_samples_per_second() const override { return samples_per_second_; } | 153 int input_samples_per_second() const override { return samples_per_second_; } |
| 154 bool primary() const override { return primary_; } | 154 bool primary() const override { return primary_; } |
| 155 bool IsDeleting() const override { return deleting_; } | 155 bool IsDeleting() const override { return deleting_; } |
| 156 MOCK_METHOD1(Initialize, | 156 MOCK_METHOD1(Initialize, |
| 157 void(const MediaPipelineBackendAlsa::RenderingDelay& | 157 void(const MediaPipelineBackendAlsa::RenderingDelay& |
| 158 mixer_rendering_delay)); | 158 mixer_rendering_delay)); |
| 159 std::string device_id() const override { return device_id_; } | 159 std::string device_id() const override { return device_id_; } |
| 160 AudioContentType content_type() const override { |
| 161 return AudioContentType::kMedia; |
| 162 } |
| 160 void set_filter_group(FilterGroup* group) override { filter_group_ = group; } | 163 void set_filter_group(FilterGroup* group) override { filter_group_ = group; } |
| 161 FilterGroup* filter_group() override { return filter_group_; } | 164 FilterGroup* filter_group() override { return filter_group_; } |
| 162 int MaxReadSize() override { return max_read_size_; } | 165 int MaxReadSize() override { return max_read_size_; } |
| 163 MOCK_METHOD2(GetResampledData, void(::media::AudioBus* dest, int frames)); | 166 MOCK_METHOD2(GetResampledData, void(::media::AudioBus* dest, int frames)); |
| 164 MOCK_METHOD4( | 167 MOCK_METHOD4( |
| 165 VolumeScaleAccumulate, | 168 VolumeScaleAccumulate, |
| 166 void(bool repeat_transition, const float* src, int frames, float* dest)); | 169 void(bool repeat_transition, const float* src, int frames, float* dest)); |
| 167 MOCK_METHOD0(OnSkipped, void()); | 170 MOCK_METHOD0(OnSkipped, void()); |
| 168 MOCK_METHOD1(AfterWriteFrames, | 171 MOCK_METHOD1(AfterWriteFrames, |
| 169 void(const MediaPipelineBackendAlsa::RenderingDelay& | 172 void(const MediaPipelineBackendAlsa::RenderingDelay& |
| 170 mixer_rendering_delay)); | 173 mixer_rendering_delay)); |
| 171 MOCK_METHOD1(SignalError, void(StreamMixerAlsaInput::MixerError error)); | 174 MOCK_METHOD1(SignalError, void(StreamMixerAlsaInput::MixerError error)); |
| 172 MOCK_METHOD1(PrepareToDelete, void(const OnReadyToDeleteCb& delete_cb)); | 175 MOCK_METHOD1(PrepareToDelete, void(const OnReadyToDeleteCb& delete_cb)); |
| 173 | 176 |
| 177 void SetContentTypeVolume(float volume) override {} |
| 178 void SetMuted(bool muted) override {} |
| 179 |
| 174 // Setters and getters for test control. | 180 // Setters and getters for test control. |
| 175 void SetPaused(bool paused) { paused_ = paused; } | 181 void SetPaused(bool paused) { paused_ = paused; } |
| 176 void SetMaxReadSize(int max_read_size) { max_read_size_ = max_read_size; } | 182 void SetMaxReadSize(int max_read_size) { max_read_size_ = max_read_size; } |
| 177 void SetData(std::unique_ptr<::media::AudioBus> data) { | 183 void SetData(std::unique_ptr<::media::AudioBus> data) { |
| 178 CHECK(!data_); | 184 CHECK(!data_); |
| 179 data_ = std::move(data); | 185 data_ = std::move(data); |
| 180 max_read_size_ = data_->frames(); | 186 max_read_size_ = data_->frames(); |
| 181 } | 187 } |
| 182 void SetVolumeMultiplier(float multiplier) { | 188 void SetVolumeMultiplier(float multiplier) { |
| 183 CHECK(multiplier >= 0.0 && multiplier <= 1.0); | 189 CHECK(multiplier >= 0.0 && multiplier <= 1.0); |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 EXPECT_CALL(*inputs[1], VolumeScaleAccumulate(_, _, _, _)).Times(0); | 791 EXPECT_CALL(*inputs[1], VolumeScaleAccumulate(_, _, _, _)).Times(0); |
| 786 EXPECT_CALL(*inputs[1], OnSkipped()); | 792 EXPECT_CALL(*inputs[1], OnSkipped()); |
| 787 EXPECT_CALL(*inputs[1], AfterWriteFrames(_)); | 793 EXPECT_CALL(*inputs[1], AfterWriteFrames(_)); |
| 788 | 794 |
| 789 EXPECT_CALL(*mock_alsa(), PcmWritei(_, _, kNumFrames)).Times(1); | 795 EXPECT_CALL(*mock_alsa(), PcmWritei(_, _, kNumFrames)).Times(1); |
| 790 mixer->WriteFramesForTest(); | 796 mixer->WriteFramesForTest(); |
| 791 } | 797 } |
| 792 | 798 |
| 793 } // namespace media | 799 } // namespace media |
| 794 } // namespace chromecast | 800 } // namespace chromecast |
| OLD | NEW |