Bug 797526 - some assertions in nsDOMClassInfo should be fatal in debug builds -...
[gecko.git] / media / webrtc / trunk / src / voice_engine / main / source / output_mixer.h
bloba5df18501d991815bb1cab57e6775317d2f84b4a
1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
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 */
11 #ifndef WEBRTC_VOICE_ENGINE_OUTPUT_MIXER_H
12 #define WEBRTC_VOICE_ENGINE_OUTPUT_MIXER_H
14 #include "audio_conference_mixer.h"
15 #include "audio_conference_mixer_defines.h"
16 #include "common_types.h"
17 #include "dtmf_inband.h"
18 #include "file_recorder.h"
19 #include "level_indicator.h"
20 #include "resampler.h"
21 #include "voice_engine_defines.h"
23 namespace webrtc {
25 class AudioProcessing;
26 class CriticalSectionWrapper;
27 class FileWrapper;
28 class VoEMediaProcess;
30 namespace voe {
32 class Statistics;
34 class OutputMixer : public AudioMixerOutputReceiver,
35 public AudioMixerStatusReceiver,
36 public FileCallback
38 public:
39 static WebRtc_Word32 Create(OutputMixer*& mixer,
40 const WebRtc_UWord32 instanceId);
42 static void Destroy(OutputMixer*& mixer);
44 WebRtc_Word32 SetEngineInformation(Statistics& engineStatistics);
46 WebRtc_Word32 SetAudioProcessingModule(
47 AudioProcessing* audioProcessingModule);
49 // VoEExternalMedia
50 int RegisterExternalMediaProcessing(
51 VoEMediaProcess& proccess_object);
53 int DeRegisterExternalMediaProcessing();
55 // VoEDtmf
56 int PlayDtmfTone(WebRtc_UWord8 eventCode,
57 int lengthMs,
58 int attenuationDb);
60 int StartPlayingDtmfTone(WebRtc_UWord8 eventCode,
61 int attenuationDb);
63 int StopPlayingDtmfTone();
65 WebRtc_Word32 MixActiveChannels();
67 WebRtc_Word32 DoOperationsOnCombinedSignal();
69 WebRtc_Word32 SetMixabilityStatus(MixerParticipant& participant,
70 const bool mixable);
72 WebRtc_Word32 SetAnonymousMixabilityStatus(MixerParticipant& participant,
73 const bool mixable);
75 WebRtc_Word32 GetMixedAudio(const WebRtc_Word32 desiredFreqHz,
76 const WebRtc_UWord8 channels,
77 AudioFrame& audioFrame);
79 // VoEVolumeControl
80 int GetSpeechOutputLevel(WebRtc_UWord32& level);
82 int GetSpeechOutputLevelFullRange(WebRtc_UWord32& level);
84 int SetOutputVolumePan(float left, float right);
86 int GetOutputVolumePan(float& left, float& right);
88 // VoEFile
89 int StartRecordingPlayout(const char* fileName,
90 const CodecInst* codecInst);
92 int StartRecordingPlayout(OutStream* stream,
93 const CodecInst* codecInst);
94 int StopRecordingPlayout();
96 virtual ~OutputMixer();
98 public: // from AudioMixerOutputReceiver
99 virtual void NewMixedAudio(
100 const WebRtc_Word32 id,
101 const AudioFrame& generalAudioFrame,
102 const AudioFrame** uniqueAudioFrames,
103 const WebRtc_UWord32 size);
105 public: // from AudioMixerStatusReceiver
106 virtual void MixedParticipants(
107 const WebRtc_Word32 id,
108 const ParticipantStatistics* participantStatistics,
109 const WebRtc_UWord32 size);
111 virtual void VADPositiveParticipants(
112 const WebRtc_Word32 id,
113 const ParticipantStatistics* participantStatistics,
114 const WebRtc_UWord32 size);
116 virtual void MixedAudioLevel(const WebRtc_Word32 id,
117 const WebRtc_UWord32 level);
119 public: // For file recording
120 void PlayNotification(const WebRtc_Word32 id,
121 const WebRtc_UWord32 durationMs);
123 void RecordNotification(const WebRtc_Word32 id,
124 const WebRtc_UWord32 durationMs);
126 void PlayFileEnded(const WebRtc_Word32 id);
127 void RecordFileEnded(const WebRtc_Word32 id);
129 private:
130 OutputMixer(const WebRtc_UWord32 instanceId);
131 int APMAnalyzeReverseStream();
132 int InsertInbandDtmfTone();
134 private: // uses
135 Statistics* _engineStatisticsPtr;
136 AudioProcessing* _audioProcessingModulePtr;
138 private: // owns
139 CriticalSectionWrapper& _callbackCritSect;
140 // protect the _outputFileRecorderPtr and _outputFileRecording
141 CriticalSectionWrapper& _fileCritSect;
142 AudioConferenceMixer& _mixerModule;
143 AudioFrame _audioFrame;
144 Resampler _resampler; // converts mixed audio to fit ADM format
145 Resampler _apmResampler; // converts mixed audio to fit APM rate
146 AudioLevel _audioLevel; // measures audio level for the combined signal
147 DtmfInband _dtmfGenerator;
148 int _instanceId;
149 VoEMediaProcess* _externalMediaCallbackPtr;
150 bool _externalMedia;
151 float _panLeft;
152 float _panRight;
153 int _mixingFrequencyHz;
154 FileRecorder* _outputFileRecorderPtr;
155 bool _outputFileRecording;
158 } // namespace voe
160 } // namespace werbtc
162 #endif // VOICE_ENGINE_OUTPUT_MIXER_H