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 #ifndef VOICE_ENGINE_OUTPUT_MIXER_H_ | 11 #ifndef VOICE_ENGINE_OUTPUT_MIXER_H_ |
12 #define VOICE_ENGINE_OUTPUT_MIXER_H_ | 12 #define VOICE_ENGINE_OUTPUT_MIXER_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include "common_audio/resampler/include/push_resampler.h" | 16 #include "common_audio/resampler/include/push_resampler.h" |
17 #include "common_types.h" // NOLINT(build/include) | 17 #include "common_types.h" // NOLINT(build/include) |
18 #include "modules/audio_conference_mixer/include/audio_conference_mixer.h" | 18 #include "modules/audio_conference_mixer/include/audio_conference_mixer.h" |
19 #include "modules/audio_conference_mixer/include/audio_conference_mixer_defines.
h" | 19 #include "modules/audio_conference_mixer/include/audio_conference_mixer_defines.
h" |
20 #include "rtc_base/criticalsection.h" | 20 #include "rtc_base/criticalsection.h" |
21 #include "voice_engine/file_recorder.h" | |
22 | 21 |
23 namespace webrtc { | 22 namespace webrtc { |
24 | 23 |
25 class AudioProcessing; | 24 class AudioProcessing; |
26 class FileWrapper; | 25 class FileWrapper; |
27 | 26 |
28 namespace voe { | 27 namespace voe { |
29 | 28 |
30 class Statistics; | 29 class Statistics; |
31 | 30 |
32 class OutputMixer : public AudioMixerOutputReceiver, | 31 class OutputMixer : public AudioMixerOutputReceiver |
33 public FileCallback | |
34 { | 32 { |
35 public: | 33 public: |
36 static int32_t Create(OutputMixer*& mixer, uint32_t instanceId); | 34 static int32_t Create(OutputMixer*& mixer, uint32_t instanceId); |
37 | 35 |
38 static void Destroy(OutputMixer*& mixer); | 36 static void Destroy(OutputMixer*& mixer); |
39 | 37 |
40 int32_t SetEngineInformation(Statistics& engineStatistics); | 38 int32_t SetEngineInformation(Statistics& engineStatistics); |
41 | 39 |
42 int32_t SetAudioProcessingModule( | 40 int32_t SetAudioProcessingModule( |
43 AudioProcessing* audioProcessingModule); | 41 AudioProcessing* audioProcessingModule); |
44 | 42 |
45 int32_t MixActiveChannels(); | 43 int32_t MixActiveChannels(); |
46 | 44 |
47 int32_t DoOperationsOnCombinedSignal(bool feed_data_to_apm); | 45 int32_t DoOperationsOnCombinedSignal(bool feed_data_to_apm); |
48 | 46 |
49 int32_t SetMixabilityStatus(MixerParticipant& participant, | 47 int32_t SetMixabilityStatus(MixerParticipant& participant, |
50 bool mixable); | 48 bool mixable); |
51 | 49 |
52 int32_t SetAnonymousMixabilityStatus(MixerParticipant& participant, | |
53 bool mixable); | |
54 | |
55 int GetMixedAudio(int sample_rate_hz, size_t num_channels, | 50 int GetMixedAudio(int sample_rate_hz, size_t num_channels, |
56 AudioFrame* audioFrame); | 51 AudioFrame* audioFrame); |
57 | 52 |
58 // VoEFile | |
59 int StartRecordingPlayout(const char* fileName, | |
60 const CodecInst* codecInst); | |
61 | |
62 int StartRecordingPlayout(OutStream* stream, | |
63 const CodecInst* codecInst); | |
64 int StopRecordingPlayout(); | |
65 | |
66 virtual ~OutputMixer(); | 53 virtual ~OutputMixer(); |
67 | 54 |
68 // from AudioMixerOutputReceiver | 55 // from AudioMixerOutputReceiver |
69 virtual void NewMixedAudio( | 56 virtual void NewMixedAudio( |
70 int32_t id, | 57 int32_t id, |
71 const AudioFrame& generalAudioFrame, | 58 const AudioFrame& generalAudioFrame, |
72 const AudioFrame** uniqueAudioFrames, | 59 const AudioFrame** uniqueAudioFrames, |
73 uint32_t size); | 60 uint32_t size); |
74 | 61 |
75 // For file recording | |
76 void PlayNotification(int32_t id, uint32_t durationMs); | |
77 | |
78 void RecordNotification(int32_t id, uint32_t durationMs); | |
79 | |
80 void PlayFileEnded(int32_t id); | |
81 void RecordFileEnded(int32_t id); | |
82 | |
83 private: | 62 private: |
84 OutputMixer(uint32_t instanceId); | 63 OutputMixer(uint32_t instanceId); |
85 | 64 |
86 // uses | 65 // uses |
87 Statistics* _engineStatisticsPtr; | 66 Statistics* _engineStatisticsPtr; |
88 AudioProcessing* _audioProcessingModulePtr; | 67 AudioProcessing* _audioProcessingModulePtr; |
89 | 68 |
90 // Protects output_file_recorder_ and _outputFileRecording. | |
91 rtc::CriticalSection _fileCritSect; | |
92 AudioConferenceMixer& _mixerModule; | 69 AudioConferenceMixer& _mixerModule; |
93 AudioFrame _audioFrame; | 70 AudioFrame _audioFrame; |
94 // Converts mixed audio to the audio device output rate. | 71 // Converts mixed audio to the audio device output rate. |
95 PushResampler<int16_t> resampler_; | 72 PushResampler<int16_t> resampler_; |
96 // Converts mixed audio to the audio processing rate. | 73 // Converts mixed audio to the audio processing rate. |
97 PushResampler<int16_t> audioproc_resampler_; | 74 PushResampler<int16_t> audioproc_resampler_; |
98 int _instanceId; | 75 int _instanceId; |
99 int _mixingFrequencyHz; | 76 int _mixingFrequencyHz; |
100 std::unique_ptr<FileRecorder> output_file_recorder_; | |
101 bool _outputFileRecording; | |
102 }; | 77 }; |
103 | 78 |
104 } // namespace voe | 79 } // namespace voe |
105 | 80 |
106 } // namespace werbtc | 81 } // namespace werbtc |
107 | 82 |
108 #endif // VOICE_ENGINE_OUTPUT_MIXER_H_ | 83 #endif // VOICE_ENGINE_OUTPUT_MIXER_H_ |
OLD | NEW |