| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include <string.h> | 11 #include <string.h> |
| 12 | 12 |
| 13 #include <limits> | 13 #include <limits> |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <utility> | 15 #include <utility> |
| 16 | 16 |
| 17 #include "webrtc/api/audio/audio_mixer.h" |
| 17 #include "webrtc/base/bind.h" | 18 #include "webrtc/base/bind.h" |
| 18 #include "webrtc/base/thread.h" | 19 #include "webrtc/base/thread.h" |
| 19 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" | 20 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" |
| 20 #include "webrtc/modules/audio_mixer/audio_mixer.h" | |
| 21 #include "webrtc/test/gmock.h" | 21 #include "webrtc/test/gmock.h" |
| 22 | 22 |
| 23 using testing::_; | 23 using testing::_; |
| 24 using testing::Exactly; | 24 using testing::Exactly; |
| 25 using testing::Invoke; | 25 using testing::Invoke; |
| 26 using testing::Return; | 26 using testing::Return; |
| 27 | 27 |
| 28 namespace webrtc { | 28 namespace webrtc { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 53 public: | 53 public: |
| 54 MockMixerAudioSource() | 54 MockMixerAudioSource() |
| 55 : fake_audio_frame_info_(AudioMixer::Source::AudioFrameInfo::kNormal) { | 55 : fake_audio_frame_info_(AudioMixer::Source::AudioFrameInfo::kNormal) { |
| 56 ON_CALL(*this, GetAudioFrameWithInfo(_)) | 56 ON_CALL(*this, GetAudioFrameWithInfo(_)) |
| 57 .WillByDefault( | 57 .WillByDefault( |
| 58 Invoke(this, &MockMixerAudioSource::FakeAudioFrameWithInfo)); | 58 Invoke(this, &MockMixerAudioSource::FakeAudioFrameWithInfo)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 MOCK_METHOD1(GetAudioFrameWithInfo, AudioFrameWithInfo(int sample_rate_hz)); | 61 MOCK_METHOD1(GetAudioFrameWithInfo, AudioFrameWithInfo(int sample_rate_hz)); |
| 62 | 62 |
| 63 MOCK_METHOD0(ssrc, int()); | 63 MOCK_METHOD0(Ssrc, int()); |
| 64 | 64 |
| 65 AudioFrame* fake_frame() { return &fake_frame_; } | 65 AudioFrame* fake_frame() { return &fake_frame_; } |
| 66 AudioFrameInfo fake_info() { return fake_audio_frame_info_; } | 66 AudioFrameInfo fake_info() { return fake_audio_frame_info_; } |
| 67 void set_fake_info(const AudioFrameInfo audio_frame_info) { | 67 void set_fake_info(const AudioFrameInfo audio_frame_info) { |
| 68 fake_audio_frame_info_ = audio_frame_info; | 68 fake_audio_frame_info_ = audio_frame_info; |
| 69 } | 69 } |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 AudioFrame fake_frame_, fake_output_frame_; | 72 AudioFrame fake_frame_, fake_output_frame_; |
| 73 AudioFrameInfo fake_audio_frame_info_; | 73 AudioFrameInfo fake_audio_frame_info_; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 kAudioSources, AudioMixer::Source::AudioFrameInfo::kNormal); | 363 kAudioSources, AudioMixer::Source::AudioFrameInfo::kNormal); |
| 364 frame_info[0] = AudioMixer::Source::AudioFrameInfo::kMuted; | 364 frame_info[0] = AudioMixer::Source::AudioFrameInfo::kMuted; |
| 365 std::fill(frames[0].data_, frames[0].data_ + kDefaultSampleRateHz / 100, | 365 std::fill(frames[0].data_, frames[0].data_ + kDefaultSampleRateHz / 100, |
| 366 std::numeric_limits<int16_t>::max()); | 366 std::numeric_limits<int16_t>::max()); |
| 367 std::vector<bool> expected_status(kAudioSources, true); | 367 std::vector<bool> expected_status(kAudioSources, true); |
| 368 expected_status[0] = false; | 368 expected_status[0] = false; |
| 369 | 369 |
| 370 MixAndCompare(frames, frame_info, expected_status); | 370 MixAndCompare(frames, frame_info, expected_status); |
| 371 } | 371 } |
| 372 } // namespace webrtc | 372 } // namespace webrtc |
| OLD | NEW |