OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 "webrtc/voice_engine/output_mixer.h" | 11 #include "webrtc/modules/audio_mixer/audio_mixer.h" |
12 | 12 |
13 #include "webrtc/base/format_macros.h" | 13 #include "webrtc/base/format_macros.h" |
14 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 14 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
15 #include "webrtc/modules/utility/include/audio_frame_operations.h" | 15 #include "webrtc/modules/utility/include/audio_frame_operations.h" |
16 #include "webrtc/system_wrappers/include/file_wrapper.h" | 16 #include "webrtc/system_wrappers/include/file_wrapper.h" |
17 #include "webrtc/system_wrappers/include/trace.h" | 17 #include "webrtc/system_wrappers/include/trace.h" |
18 #include "webrtc/voice_engine/include/voe_external_media.h" | 18 #include "webrtc/voice_engine/include/voe_external_media.h" |
19 #include "webrtc/voice_engine/statistics.h" | 19 #include "webrtc/voice_engine/statistics.h" |
20 #include "webrtc/voice_engine/utility.h" | 20 #include "webrtc/voice_engine/utility.h" |
21 | 21 |
22 namespace webrtc { | 22 namespace webrtc { |
23 namespace voe { | 23 namespace voe { |
24 | 24 |
25 void | 25 void |
26 OutputMixer::NewMixedAudio(int32_t id, | 26 AudioMixer::NewMixedAudio(int32_t id, |
27 const AudioFrame& generalAudioFrame, | 27 const AudioFrame& generalAudioFrame, |
28 const AudioFrame** uniqueAudioFrames, | 28 const AudioFrame** uniqueAudioFrames, |
29 uint32_t size) | 29 uint32_t size) |
30 { | 30 { |
31 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,-1), | 31 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,-1), |
32 "OutputMixer::NewMixedAudio(id=%d, size=%u)", id, size); | 32 "AudioMixer::NewMixedAudio(id=%d, size=%u)", id, size); |
33 | 33 |
34 _audioFrame.CopyFrom(generalAudioFrame); | 34 _audioFrame.CopyFrom(generalAudioFrame); |
35 _audioFrame.id_ = id; | 35 _audioFrame.id_ = id; |
36 } | 36 } |
37 | 37 |
38 void OutputMixer::PlayNotification(int32_t id, uint32_t durationMs) | 38 void AudioMixer::PlayNotification(int32_t id, uint32_t durationMs) |
39 { | 39 { |
40 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,-1), | 40 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,-1), |
41 "OutputMixer::PlayNotification(id=%d, durationMs=%d)", | 41 "AudioMixer::PlayNotification(id=%d, durationMs=%d)", |
42 id, durationMs); | 42 id, durationMs); |
43 // Not implement yet | 43 // Not implement yet |
44 } | 44 } |
45 | 45 |
46 void OutputMixer::RecordNotification(int32_t id, | 46 void AudioMixer::RecordNotification(int32_t id, |
47 uint32_t durationMs) | 47 uint32_t durationMs) |
48 { | 48 { |
49 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,-1), | 49 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,-1), |
50 "OutputMixer::RecordNotification(id=%d, durationMs=%d)", | 50 "AudioMixer::RecordNotification(id=%d, durationMs=%d)", |
51 id, durationMs); | 51 id, durationMs); |
52 | 52 |
53 // Not implement yet | 53 // Not implement yet |
54 } | 54 } |
55 | 55 |
56 void OutputMixer::PlayFileEnded(int32_t id) | 56 void AudioMixer::PlayFileEnded(int32_t id) |
57 { | 57 { |
58 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,-1), | 58 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,-1), |
59 "OutputMixer::PlayFileEnded(id=%d)", id); | 59 "AudioMixer::PlayFileEnded(id=%d)", id); |
60 | 60 |
61 // not needed | 61 // not needed |
62 } | 62 } |
63 | 63 |
64 void OutputMixer::RecordFileEnded(int32_t id) | 64 void AudioMixer::RecordFileEnded(int32_t id) |
65 { | 65 { |
66 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,-1), | 66 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,-1), |
67 "OutputMixer::RecordFileEnded(id=%d)", id); | 67 "AudioMixer::RecordFileEnded(id=%d)", id); |
68 assert(id == _instanceId); | 68 assert(id == _instanceId); |
69 | 69 |
70 rtc::CritScope cs(&_fileCritSect); | 70 rtc::CritScope cs(&_fileCritSect); |
71 _outputFileRecording = false; | 71 _outputFileRecording = false; |
72 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,-1), | 72 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,-1), |
73 "OutputMixer::RecordFileEnded() =>" | 73 "AudioMixer::RecordFileEnded() =>" |
74 "output file recorder module is shutdown"); | 74 "output file recorder module is shutdown"); |
75 } | 75 } |
76 | 76 |
77 int32_t | 77 int32_t |
78 OutputMixer::Create(OutputMixer*& mixer, uint32_t instanceId) | 78 AudioMixer::Create(AudioMixer*& mixer, uint32_t instanceId) |
79 { | 79 { |
80 WEBRTC_TRACE(kTraceMemory, kTraceVoice, instanceId, | 80 WEBRTC_TRACE(kTraceMemory, kTraceVoice, instanceId, |
81 "OutputMixer::Create(instanceId=%d)", instanceId); | 81 "AudioMixer::Create(instanceId=%d)", instanceId); |
82 mixer = new OutputMixer(instanceId); | 82 mixer = new AudioMixer(instanceId); |
83 if (mixer == NULL) | 83 if (mixer == NULL) |
84 { | 84 { |
85 WEBRTC_TRACE(kTraceMemory, kTraceVoice, instanceId, | 85 WEBRTC_TRACE(kTraceMemory, kTraceVoice, instanceId, |
86 "OutputMixer::Create() unable to allocate memory for" | 86 "AudioMixer::Create() unable to allocate memory for" |
87 "mixer"); | 87 "mixer"); |
88 return -1; | 88 return -1; |
89 } | 89 } |
90 return 0; | 90 return 0; |
91 } | 91 } |
92 | 92 |
93 OutputMixer::OutputMixer(uint32_t instanceId) : | 93 AudioMixer::AudioMixer(uint32_t instanceId) : |
94 _mixerModule(*AudioConferenceMixer::Create(instanceId)), | 94 _mixerModule(*NewAudioConferenceMixer::Create(instanceId)), |
95 _audioLevel(), | 95 _audioLevel(), |
96 _instanceId(instanceId), | 96 _instanceId(instanceId), |
97 _externalMediaCallbackPtr(NULL), | 97 _externalMediaCallbackPtr(NULL), |
98 _externalMedia(false), | 98 _externalMedia(false), |
99 _panLeft(1.0f), | 99 _panLeft(1.0f), |
100 _panRight(1.0f), | 100 _panRight(1.0f), |
101 _mixingFrequencyHz(8000), | 101 _mixingFrequencyHz(8000), |
102 _outputFileRecorderPtr(NULL), | 102 _outputFileRecorderPtr(NULL), |
103 _outputFileRecording(false) | 103 _outputFileRecording(false) |
104 { | 104 { |
105 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,-1), | 105 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,-1), |
106 "OutputMixer::OutputMixer() - ctor"); | 106 "AudioMixer::AudioMixer() - ctor"); |
107 | 107 |
108 if (_mixerModule.RegisterMixedStreamCallback(this) == -1) | 108 if (_mixerModule.RegisterMixedStreamCallback(this) == -1) |
109 { | 109 { |
110 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId,-1), | 110 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId,-1), |
111 "OutputMixer::OutputMixer() failed to register mixer" | 111 "AudioMixer::AudioMixer() failed to register mixer" |
112 "callbacks"); | 112 "callbacks"); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 void | 116 void |
117 OutputMixer::Destroy(OutputMixer*& mixer) | 117 AudioMixer::Destroy(AudioMixer*& mixer) |
118 { | 118 { |
119 if (mixer) | 119 if (mixer) |
120 { | 120 { |
121 delete mixer; | 121 delete mixer; |
122 mixer = NULL; | 122 mixer = NULL; |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 OutputMixer::~OutputMixer() | 126 AudioMixer::~AudioMixer() |
127 { | 127 { |
128 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,-1), | 128 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,-1), |
129 "OutputMixer::~OutputMixer() - dtor"); | 129 "AudioMixer::~AudioMixer() - dtor"); |
130 if (_externalMedia) | 130 if (_externalMedia) |
131 { | 131 { |
132 DeRegisterExternalMediaProcessing(); | 132 DeRegisterExternalMediaProcessing(); |
133 } | 133 } |
134 { | 134 { |
135 rtc::CritScope cs(&_fileCritSect); | 135 rtc::CritScope cs(&_fileCritSect); |
136 if (_outputFileRecorderPtr) | 136 if (_outputFileRecorderPtr) |
137 { | 137 { |
138 _outputFileRecorderPtr->RegisterModuleFileCallback(NULL); | 138 _outputFileRecorderPtr->RegisterModuleFileCallback(NULL); |
139 _outputFileRecorderPtr->StopRecording(); | 139 _outputFileRecorderPtr->StopRecording(); |
140 FileRecorder::DestroyFileRecorder(_outputFileRecorderPtr); | 140 FileRecorder::DestroyFileRecorder(_outputFileRecorderPtr); |
141 _outputFileRecorderPtr = NULL; | 141 _outputFileRecorderPtr = NULL; |
142 } | 142 } |
143 } | 143 } |
144 _mixerModule.UnRegisterMixedStreamCallback(); | 144 _mixerModule.UnRegisterMixedStreamCallback(); |
145 delete &_mixerModule; | 145 delete &_mixerModule; |
146 } | 146 } |
147 | 147 |
148 int32_t | 148 int32_t |
149 OutputMixer::SetEngineInformation(voe::Statistics& engineStatistics) | 149 AudioMixer::SetEngineInformation(voe::Statistics& engineStatistics) |
150 { | 150 { |
151 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), | 151 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), |
152 "OutputMixer::SetEngineInformation()"); | 152 "AudioMixer::SetEngineInformation()"); |
153 _engineStatisticsPtr = &engineStatistics; | 153 _engineStatisticsPtr = &engineStatistics; |
154 return 0; | 154 return 0; |
155 } | 155 } |
156 | 156 |
157 int32_t | 157 int32_t |
158 OutputMixer::SetAudioProcessingModule(AudioProcessing* audioProcessingModule) | 158 AudioMixer::SetAudioProcessingModule(AudioProcessing* audioProcessingModule) |
159 { | 159 { |
160 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), | 160 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), |
161 "OutputMixer::SetAudioProcessingModule(" | 161 "AudioMixer::SetAudioProcessingModule(" |
162 "audioProcessingModule=0x%x)", audioProcessingModule); | 162 "audioProcessingModule=0x%x)", audioProcessingModule); |
163 _audioProcessingModulePtr = audioProcessingModule; | 163 _audioProcessingModulePtr = audioProcessingModule; |
164 return 0; | 164 return 0; |
165 } | 165 } |
166 | 166 |
167 int OutputMixer::RegisterExternalMediaProcessing( | 167 int AudioMixer::RegisterExternalMediaProcessing( |
168 VoEMediaProcess& proccess_object) | 168 VoEMediaProcess& proccess_object) |
169 { | 169 { |
170 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), | 170 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), |
171 "OutputMixer::RegisterExternalMediaProcessing()"); | 171 "AudioMixer::RegisterExternalMediaProcessing()"); |
172 | 172 |
173 rtc::CritScope cs(&_callbackCritSect); | 173 rtc::CritScope cs(&_callbackCritSect); |
174 _externalMediaCallbackPtr = &proccess_object; | 174 _externalMediaCallbackPtr = &proccess_object; |
175 _externalMedia = true; | 175 _externalMedia = true; |
176 | 176 |
177 return 0; | 177 return 0; |
178 } | 178 } |
179 | 179 |
180 int OutputMixer::DeRegisterExternalMediaProcessing() | 180 int AudioMixer::DeRegisterExternalMediaProcessing() |
181 { | 181 { |
182 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), | 182 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), |
183 "OutputMixer::DeRegisterExternalMediaProcessing()"); | 183 "AudioMixer::DeRegisterExternalMediaProcessing()"); |
184 | 184 |
185 rtc::CritScope cs(&_callbackCritSect); | 185 rtc::CritScope cs(&_callbackCritSect); |
186 _externalMedia = false; | 186 _externalMedia = false; |
187 _externalMediaCallbackPtr = NULL; | 187 _externalMediaCallbackPtr = NULL; |
188 | 188 |
189 return 0; | 189 return 0; |
190 } | 190 } |
191 | 191 |
192 int32_t | 192 int32_t |
193 OutputMixer::SetMixabilityStatus(MixerParticipant& participant, | 193 AudioMixer::SetMixabilityStatus(MixerAudioSource& participant, |
194 bool mixable) | 194 bool mixable) |
ivoc
2016/07/01 07:56:26
Formatting seems off (nr of spaces)
| |
195 { | 195 { |
196 return _mixerModule.SetMixabilityStatus(&participant, mixable); | 196 return _mixerModule.SetMixabilityStatus(&participant, mixable); |
197 } | 197 } |
198 | 198 |
199 int32_t | 199 int32_t |
200 OutputMixer::SetAnonymousMixabilityStatus(MixerParticipant& participant, | 200 AudioMixer::SetAnonymousMixabilityStatus(MixerAudioSource& participant, |
201 bool mixable) | 201 bool mixable) |
ivoc
2016/07/01 07:56:26
And here.
| |
202 { | 202 { |
203 return _mixerModule.SetAnonymousMixabilityStatus(&participant, mixable); | 203 return _mixerModule.SetAnonymousMixabilityStatus(&participant, mixable); |
204 } | 204 } |
205 | 205 |
206 int32_t | 206 int32_t |
207 OutputMixer::MixActiveChannels() | 207 AudioMixer::MixActiveChannels() |
208 { | 208 { |
209 _mixerModule.Process(); | 209 _mixerModule.Process(); |
210 return 0; | 210 return 0; |
211 } | 211 } |
212 | 212 |
213 int | 213 int |
214 OutputMixer::GetSpeechOutputLevel(uint32_t& level) | 214 AudioMixer::GetSpeechOutputLevel(uint32_t& level) |
215 { | 215 { |
216 int8_t currentLevel = _audioLevel.Level(); | 216 int8_t currentLevel = _audioLevel.Level(); |
217 level = static_cast<uint32_t> (currentLevel); | 217 level = static_cast<uint32_t> (currentLevel); |
218 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,-1), | 218 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,-1), |
219 "GetSpeechOutputLevel() => level=%u", level); | 219 "GetSpeechOutputLevel() => level=%u", level); |
220 return 0; | 220 return 0; |
221 } | 221 } |
222 | 222 |
223 int | 223 int |
224 OutputMixer::GetSpeechOutputLevelFullRange(uint32_t& level) | 224 AudioMixer::GetSpeechOutputLevelFullRange(uint32_t& level) |
225 { | 225 { |
226 int16_t currentLevel = _audioLevel.LevelFullRange(); | 226 int16_t currentLevel = _audioLevel.LevelFullRange(); |
227 level = static_cast<uint32_t> (currentLevel); | 227 level = static_cast<uint32_t> (currentLevel); |
228 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,-1), | 228 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,-1), |
229 "GetSpeechOutputLevelFullRange() => level=%u", level); | 229 "GetSpeechOutputLevelFullRange() => level=%u", level); |
230 return 0; | 230 return 0; |
231 } | 231 } |
232 | 232 |
233 int | 233 int |
234 OutputMixer::SetOutputVolumePan(float left, float right) | 234 AudioMixer::SetOutputVolumePan(float left, float right) |
235 { | 235 { |
236 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), | 236 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), |
237 "OutputMixer::SetOutputVolumePan()"); | 237 "AudioMixer::SetOutputVolumePan()"); |
238 _panLeft = left; | 238 _panLeft = left; |
239 _panRight = right; | 239 _panRight = right; |
240 return 0; | 240 return 0; |
241 } | 241 } |
242 | 242 |
243 int | 243 int |
244 OutputMixer::GetOutputVolumePan(float& left, float& right) | 244 AudioMixer::GetOutputVolumePan(float& left, float& right) |
245 { | 245 { |
246 left = _panLeft; | 246 left = _panLeft; |
247 right = _panRight; | 247 right = _panRight; |
248 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,-1), | 248 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,-1), |
249 "GetOutputVolumePan() => left=%2.1f, right=%2.1f", | 249 "GetOutputVolumePan() => left=%2.1f, right=%2.1f", |
250 left, right); | 250 left, right); |
251 return 0; | 251 return 0; |
252 } | 252 } |
253 | 253 |
254 int OutputMixer::StartRecordingPlayout(const char* fileName, | 254 int AudioMixer::StartRecordingPlayout(const char* fileName, |
255 const CodecInst* codecInst) | 255 const CodecInst* codecInst) |
256 { | 256 { |
257 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), | 257 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), |
258 "OutputMixer::StartRecordingPlayout(fileName=%s)", fileName); | 258 "AudioMixer::StartRecordingPlayout(fileName=%s)", fileName); |
259 | 259 |
260 if (_outputFileRecording) | 260 if (_outputFileRecording) |
261 { | 261 { |
262 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,-1), | 262 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,-1), |
263 "StartRecordingPlayout() is already recording"); | 263 "StartRecordingPlayout() is already recording"); |
264 return 0; | 264 return 0; |
265 } | 265 } |
266 | 266 |
267 FileFormats format; | 267 FileFormats format; |
268 const uint32_t notificationTime(0); | 268 const uint32_t notificationTime(0); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 FileRecorder::DestroyFileRecorder(_outputFileRecorderPtr); | 325 FileRecorder::DestroyFileRecorder(_outputFileRecorderPtr); |
326 _outputFileRecorderPtr = NULL; | 326 _outputFileRecorderPtr = NULL; |
327 return -1; | 327 return -1; |
328 } | 328 } |
329 _outputFileRecorderPtr->RegisterModuleFileCallback(this); | 329 _outputFileRecorderPtr->RegisterModuleFileCallback(this); |
330 _outputFileRecording = true; | 330 _outputFileRecording = true; |
331 | 331 |
332 return 0; | 332 return 0; |
333 } | 333 } |
334 | 334 |
335 int OutputMixer::StartRecordingPlayout(OutStream* stream, | 335 int AudioMixer::StartRecordingPlayout(OutStream* stream, |
336 const CodecInst* codecInst) | 336 const CodecInst* codecInst) |
337 { | 337 { |
338 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), | 338 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), |
339 "OutputMixer::StartRecordingPlayout()"); | 339 "AudioMixer::StartRecordingPlayout()"); |
340 | 340 |
341 if (_outputFileRecording) | 341 if (_outputFileRecording) |
342 { | 342 { |
343 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,-1), | 343 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,-1), |
344 "StartRecordingPlayout() is already recording"); | 344 "StartRecordingPlayout() is already recording"); |
345 return 0; | 345 return 0; |
346 } | 346 } |
347 | 347 |
348 FileFormats format; | 348 FileFormats format; |
349 const uint32_t notificationTime(0); | 349 const uint32_t notificationTime(0); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
404 _outputFileRecorderPtr = NULL; | 404 _outputFileRecorderPtr = NULL; |
405 return -1; | 405 return -1; |
406 } | 406 } |
407 | 407 |
408 _outputFileRecorderPtr->RegisterModuleFileCallback(this); | 408 _outputFileRecorderPtr->RegisterModuleFileCallback(this); |
409 _outputFileRecording = true; | 409 _outputFileRecording = true; |
410 | 410 |
411 return 0; | 411 return 0; |
412 } | 412 } |
413 | 413 |
414 int OutputMixer::StopRecordingPlayout() | 414 int AudioMixer::StopRecordingPlayout() |
415 { | 415 { |
416 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), | 416 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), |
417 "OutputMixer::StopRecordingPlayout()"); | 417 "AudioMixer::StopRecordingPlayout()"); |
418 | 418 |
419 if (!_outputFileRecording) | 419 if (!_outputFileRecording) |
420 { | 420 { |
421 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId,-1), | 421 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId,-1), |
422 "StopRecordingPlayout() file isnot recording"); | 422 "StopRecordingPlayout() file isnot recording"); |
423 return -1; | 423 return -1; |
424 } | 424 } |
425 | 425 |
426 rtc::CritScope cs(&_fileCritSect); | 426 rtc::CritScope cs(&_fileCritSect); |
427 | 427 |
428 if (_outputFileRecorderPtr->StopRecording() != 0) | 428 if (_outputFileRecorderPtr->StopRecording() != 0) |
429 { | 429 { |
430 _engineStatisticsPtr->SetLastError( | 430 _engineStatisticsPtr->SetLastError( |
431 VE_STOP_RECORDING_FAILED, kTraceError, | 431 VE_STOP_RECORDING_FAILED, kTraceError, |
432 "StopRecording(), could not stop recording"); | 432 "StopRecording(), could not stop recording"); |
433 return -1; | 433 return -1; |
434 } | 434 } |
435 _outputFileRecorderPtr->RegisterModuleFileCallback(NULL); | 435 _outputFileRecorderPtr->RegisterModuleFileCallback(NULL); |
436 FileRecorder::DestroyFileRecorder(_outputFileRecorderPtr); | 436 FileRecorder::DestroyFileRecorder(_outputFileRecorderPtr); |
437 _outputFileRecorderPtr = NULL; | 437 _outputFileRecorderPtr = NULL; |
438 _outputFileRecording = false; | 438 _outputFileRecording = false; |
439 | 439 |
440 return 0; | 440 return 0; |
441 } | 441 } |
442 | 442 |
443 int OutputMixer::GetMixedAudio(int sample_rate_hz, | 443 int AudioMixer::GetMixedAudio(int sample_rate_hz, |
444 size_t num_channels, | 444 size_t num_channels, |
445 AudioFrame* frame) { | 445 AudioFrame* frame) { |
446 WEBRTC_TRACE( | 446 WEBRTC_TRACE( |
447 kTraceStream, kTraceVoice, VoEId(_instanceId,-1), | 447 kTraceStream, kTraceVoice, VoEId(_instanceId,-1), |
448 "OutputMixer::GetMixedAudio(sample_rate_hz=%d, num_channels=%" PRIuS ")", | 448 "AudioMixer::GetMixedAudio(sample_rate_hz=%d, num_channels=%" PRIuS ")", |
449 sample_rate_hz, num_channels); | 449 sample_rate_hz, num_channels); |
450 | 450 |
451 // --- Record playout if enabled | 451 // --- Record playout if enabled |
452 { | 452 { |
453 rtc::CritScope cs(&_fileCritSect); | 453 rtc::CritScope cs(&_fileCritSect); |
454 if (_outputFileRecording && _outputFileRecorderPtr) | 454 if (_outputFileRecording && _outputFileRecorderPtr) |
455 _outputFileRecorderPtr->RecordAudioToFile(_audioFrame); | 455 _outputFileRecorderPtr->RecordAudioToFile(_audioFrame); |
456 } | 456 } |
457 | 457 |
458 frame->num_channels_ = num_channels; | 458 frame->num_channels_ = num_channels; |
459 frame->sample_rate_hz_ = sample_rate_hz; | 459 frame->sample_rate_hz_ = sample_rate_hz; |
460 // TODO(andrew): Ideally the downmixing would occur much earlier, in | 460 // TODO(andrew): Ideally the downmixing would occur much earlier, in |
461 // AudioCodingModule. | 461 // AudioCodingModule. |
462 RemixAndResample(_audioFrame, &resampler_, frame); | 462 RemixAndResample(_audioFrame, &resampler_, frame); |
463 return 0; | 463 return 0; |
464 } | 464 } |
465 | 465 |
466 int32_t | 466 int32_t |
467 OutputMixer::DoOperationsOnCombinedSignal(bool feed_data_to_apm) | 467 AudioMixer::DoOperationsOnCombinedSignal(bool feed_data_to_apm) |
468 { | 468 { |
469 if (_audioFrame.sample_rate_hz_ != _mixingFrequencyHz) | 469 if (_audioFrame.sample_rate_hz_ != _mixingFrequencyHz) |
470 { | 470 { |
471 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,-1), | 471 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,-1), |
472 "OutputMixer::DoOperationsOnCombinedSignal() => " | 472 "AudioMixer::DoOperationsOnCombinedSignal() => " |
473 "mixing frequency = %d", _audioFrame.sample_rate_hz_); | 473 "mixing frequency = %d", _audioFrame.sample_rate_hz_); |
474 _mixingFrequencyHz = _audioFrame.sample_rate_hz_; | 474 _mixingFrequencyHz = _audioFrame.sample_rate_hz_; |
475 } | 475 } |
476 | 476 |
477 // Scale left and/or right channel(s) if balance is active | 477 // Scale left and/or right channel(s) if balance is active |
478 if (_panLeft != 1.0 || _panRight != 1.0) | 478 if (_panLeft != 1.0 || _panRight != 1.0) |
479 { | 479 { |
480 if (_audioFrame.num_channels_ == 1) | 480 if (_audioFrame.num_channels_ == 1) |
481 { | 481 { |
482 AudioFrameOperations::MonoToStereo(&_audioFrame); | 482 AudioFrameOperations::MonoToStereo(&_audioFrame); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 } | 518 } |
519 } | 519 } |
520 | 520 |
521 // --- Measure audio level (0-9) for the combined signal | 521 // --- Measure audio level (0-9) for the combined signal |
522 _audioLevel.ComputeLevel(_audioFrame); | 522 _audioLevel.ComputeLevel(_audioFrame); |
523 | 523 |
524 return 0; | 524 return 0; |
525 } | 525 } |
526 } // namespace voe | 526 } // namespace voe |
527 } // namespace webrtc | 527 } // namespace webrtc |
OLD | NEW |