OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #ifndef WEBRTC_VOICE_ENGINE_OUTPUT_MIXER_H_ |
| 12 #define WEBRTC_VOICE_ENGINE_OUTPUT_MIXER_H_ |
| 13 |
| 14 #include "webrtc/base/criticalsection.h" |
| 15 #include "webrtc/common_audio/resampler/include/push_resampler.h" |
| 16 #include "webrtc/common_types.h" |
| 17 #include "webrtc/modules/audio_mixer/include/audio_conference_mixer.h" |
| 18 #include "webrtc/modules/audio_mixer/include/audio_conference_mixer_defines.h" |
| 19 #include "webrtc/modules/utility/include/file_recorder.h" |
| 20 #include "webrtc/voice_engine/level_indicator.h" |
| 21 #include "webrtc/voice_engine/voice_engine_defines.h" |
| 22 |
| 23 namespace webrtc { |
| 24 |
| 25 class AudioProcessing; |
| 26 class FileWrapper; |
| 27 class VoEMediaProcess; |
| 28 |
| 29 namespace voe { |
| 30 class Statistics; |
| 31 |
| 32 class AudioMixer : public AudioMixerOutputReceiver, public FileCallback { |
| 33 public: |
| 34 static int32_t Create(AudioMixer*& mixer, uint32_t instanceId); |
| 35 |
| 36 static void Destroy(AudioMixer*& mixer); |
| 37 |
| 38 int32_t SetEngineInformation(Statistics& engineStatistics); |
| 39 |
| 40 int32_t SetAudioProcessingModule(AudioProcessing* audioProcessingModule); |
| 41 |
| 42 // VoEExternalMedia |
| 43 int RegisterExternalMediaProcessing(VoEMediaProcess& proccess_object); |
| 44 |
| 45 int DeRegisterExternalMediaProcessing(); |
| 46 |
| 47 int32_t MixActiveChannels(); |
| 48 |
| 49 int32_t DoOperationsOnCombinedSignal(bool feed_data_to_apm); |
| 50 |
| 51 int32_t SetMixabilityStatus(MixerAudioSource& participant, bool mixable); |
| 52 |
| 53 int32_t SetAnonymousMixabilityStatus(MixerAudioSource& participant, |
| 54 bool mixable); |
| 55 |
| 56 int GetMixedAudio(int sample_rate_hz, |
| 57 size_t num_channels, |
| 58 AudioFrame* audioFrame); |
| 59 |
| 60 // VoEVolumeControl |
| 61 int GetSpeechOutputLevel(uint32_t& level); |
| 62 |
| 63 int GetSpeechOutputLevelFullRange(uint32_t& level); |
| 64 |
| 65 int SetOutputVolumePan(float left, float right); |
| 66 |
| 67 int GetOutputVolumePan(float& left, float& right); |
| 68 |
| 69 // VoEFile |
| 70 int StartRecordingPlayout(const char* fileName, const CodecInst* codecInst); |
| 71 |
| 72 int StartRecordingPlayout(OutStream* stream, const CodecInst* codecInst); |
| 73 int StopRecordingPlayout(); |
| 74 |
| 75 virtual ~AudioMixer(); |
| 76 |
| 77 // from AudioMixerOutputReceiver |
| 78 virtual void NewMixedAudio(int32_t id, |
| 79 const AudioFrame& generalAudioFrame, |
| 80 const AudioFrame** uniqueAudioFrames, |
| 81 uint32_t size); |
| 82 |
| 83 // For file recording |
| 84 void PlayNotification(int32_t id, uint32_t durationMs); |
| 85 |
| 86 void RecordNotification(int32_t id, uint32_t durationMs); |
| 87 |
| 88 void PlayFileEnded(int32_t id); |
| 89 void RecordFileEnded(int32_t id); |
| 90 |
| 91 private: |
| 92 AudioMixer(uint32_t instanceId); |
| 93 |
| 94 // uses |
| 95 Statistics* _engineStatisticsPtr; |
| 96 AudioProcessing* _audioProcessingModulePtr; |
| 97 |
| 98 rtc::CriticalSection _callbackCritSect; |
| 99 // protect the _outputFileRecorderPtr and _outputFileRecording |
| 100 rtc::CriticalSection _fileCritSect; |
| 101 NewAudioConferenceMixer& _mixerModule; |
| 102 AudioFrame _audioFrame; |
| 103 // Converts mixed audio to the audio device output rate. |
| 104 PushResampler<int16_t> resampler_; |
| 105 // Converts mixed audio to the audio processing rate. |
| 106 PushResampler<int16_t> audioproc_resampler_; |
| 107 AudioLevel _audioLevel; // measures audio level for the combined signal |
| 108 int _instanceId; |
| 109 VoEMediaProcess* _externalMediaCallbackPtr; |
| 110 bool _externalMedia; |
| 111 float _panLeft; |
| 112 float _panRight; |
| 113 int _mixingFrequencyHz; |
| 114 FileRecorder* _outputFileRecorderPtr; |
| 115 bool _outputFileRecording; |
| 116 }; |
| 117 |
| 118 } // namespace voe |
| 119 |
| 120 } // namespace werbtc |
| 121 |
| 122 #endif // VOICE_ENGINE_OUTPUT_MIXER_H_ |
OLD | NEW |