Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: voice_engine/transmit_mixer.h

Issue 3013033002: Remove VoEFile (Closed)
Patch Set: rebase Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « voice_engine/output_mixer.cc ('k') | voice_engine/transmit_mixer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_TRANSMIT_MIXER_H_ 11 #ifndef VOICE_ENGINE_TRANSMIT_MIXER_H_
12 #define VOICE_ENGINE_TRANSMIT_MIXER_H_ 12 #define VOICE_ENGINE_TRANSMIT_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_processing/typing_detection.h" 18 #include "modules/audio_processing/typing_detection.h"
19 #include "modules/include/module_common_types.h" 19 #include "modules/include/module_common_types.h"
20 #include "rtc_base/criticalsection.h" 20 #include "rtc_base/criticalsection.h"
21 #include "voice_engine/audio_level.h" 21 #include "voice_engine/audio_level.h"
22 #include "voice_engine/file_player.h"
23 #include "voice_engine/file_recorder.h"
24 #include "voice_engine/include/voe_base.h" 22 #include "voice_engine/include/voe_base.h"
25 #include "voice_engine/monitor_module.h" 23 #include "voice_engine/monitor_module.h"
26 #include "voice_engine/voice_engine_defines.h" 24 #include "voice_engine/voice_engine_defines.h"
27 25
28 #if !defined(WEBRTC_ANDROID) && !defined(WEBRTC_IOS) 26 #if !defined(WEBRTC_ANDROID) && !defined(WEBRTC_IOS)
29 #define WEBRTC_VOICE_ENGINE_TYPING_DETECTION 1 27 #define WEBRTC_VOICE_ENGINE_TYPING_DETECTION 1
30 #else 28 #else
31 #define WEBRTC_VOICE_ENGINE_TYPING_DETECTION 0 29 #define WEBRTC_VOICE_ENGINE_TYPING_DETECTION 0
32 #endif 30 #endif
33 31
34 namespace webrtc { 32 namespace webrtc {
35 class AudioProcessing; 33 class AudioProcessing;
36 class ProcessThread; 34 class ProcessThread;
37 35
38 namespace voe { 36 namespace voe {
39 37
40 class ChannelManager; 38 class ChannelManager;
41 class MixedAudio; 39 class MixedAudio;
42 class Statistics; 40 class Statistics;
43 41
44 class TransmitMixer : public FileCallback { 42 class TransmitMixer {
45 public: 43 public:
46 static int32_t Create(TransmitMixer*& mixer, uint32_t instanceId); 44 static int32_t Create(TransmitMixer*& mixer, uint32_t instanceId);
47 45
48 static void Destroy(TransmitMixer*& mixer); 46 static void Destroy(TransmitMixer*& mixer);
49 47
50 int32_t SetEngineInformation(ProcessThread& processThread, 48 int32_t SetEngineInformation(ProcessThread& processThread,
51 Statistics& engineStatistics, 49 Statistics& engineStatistics,
52 ChannelManager& channelManager); 50 ChannelManager& channelManager);
53 51
54 int32_t SetAudioProcessingModule( 52 int32_t SetAudioProcessingModule(
(...skipping 22 matching lines...) Expand all
77 virtual int16_t AudioLevelFullRange() const; 75 virtual int16_t AudioLevelFullRange() const;
78 76
79 // See description of "totalAudioEnergy" in the WebRTC stats spec: 77 // See description of "totalAudioEnergy" in the WebRTC stats spec:
80 // https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats-totalaud ioenergy 78 // https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats-totalaud ioenergy
81 // 'virtual' to allow mocking. 79 // 'virtual' to allow mocking.
82 virtual double GetTotalInputEnergy() const; 80 virtual double GetTotalInputEnergy() const;
83 81
84 // 'virtual' to allow mocking. 82 // 'virtual' to allow mocking.
85 virtual double GetTotalInputDuration() const; 83 virtual double GetTotalInputDuration() const;
86 84
87 bool IsRecordingCall();
88
89 bool IsRecordingMic();
90
91 int StartPlayingFileAsMicrophone(const char* fileName,
92 bool loop,
93 FileFormats format,
94 int startPosition,
95 float volumeScaling,
96 int stopPosition,
97 const CodecInst* codecInst);
98
99 int StartPlayingFileAsMicrophone(InStream* stream,
100 FileFormats format,
101 int startPosition,
102 float volumeScaling,
103 int stopPosition,
104 const CodecInst* codecInst);
105
106 int StopPlayingFileAsMicrophone();
107
108 int IsPlayingFileAsMicrophone() const;
109
110 int StartRecordingMicrophone(const char* fileName,
111 const CodecInst* codecInst);
112
113 int StartRecordingMicrophone(OutStream* stream,
114 const CodecInst* codecInst);
115
116 int StopRecordingMicrophone();
117
118 int StartRecordingCall(const char* fileName, const CodecInst* codecInst);
119
120 int StartRecordingCall(OutStream* stream, const CodecInst* codecInst);
121
122 int StopRecordingCall();
123
124 void SetMixWithMicStatus(bool mix);
125
126 int32_t RegisterVoiceEngineObserver(VoiceEngineObserver& observer); 85 int32_t RegisterVoiceEngineObserver(VoiceEngineObserver& observer);
127 86
128 virtual ~TransmitMixer(); 87 virtual ~TransmitMixer();
129 88
130 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION 89 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
131 // Periodic callback from the MonitorModule. 90 // Periodic callback from the MonitorModule.
132 void OnPeriodicProcess(); 91 void OnPeriodicProcess();
133 #endif 92 #endif
134 93
135 // FileCallback
136 void PlayNotification(const int32_t id,
137 const uint32_t durationMs);
138
139 void RecordNotification(const int32_t id,
140 const uint32_t durationMs);
141
142 void PlayFileEnded(const int32_t id);
143
144 void RecordFileEnded(const int32_t id);
145
146 // Virtual to allow mocking. 94 // Virtual to allow mocking.
147 virtual void EnableStereoChannelSwapping(bool enable); 95 virtual void EnableStereoChannelSwapping(bool enable);
148 bool IsStereoChannelSwappingEnabled(); 96 bool IsStereoChannelSwappingEnabled();
149 97
150 protected: 98 protected:
151 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION 99 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
152 TransmitMixer() : _monitorModule(this) {} 100 TransmitMixer() : _monitorModule(this) {}
153 #else 101 #else
154 TransmitMixer() = default; 102 TransmitMixer() = default;
155 #endif 103 #endif
156 104
157 private: 105 private:
158 TransmitMixer(uint32_t instanceId); 106 TransmitMixer(uint32_t instanceId);
159 107
160 // Gets the maximum sample rate and number of channels over all currently 108 // Gets the maximum sample rate and number of channels over all currently
161 // sending codecs. 109 // sending codecs.
162 void GetSendCodecInfo(int* max_sample_rate, size_t* max_channels); 110 void GetSendCodecInfo(int* max_sample_rate, size_t* max_channels);
163 111
164 void GenerateAudioFrame(const int16_t audioSamples[], 112 void GenerateAudioFrame(const int16_t audioSamples[],
165 size_t nSamples, 113 size_t nSamples,
166 size_t nChannels, 114 size_t nChannels,
167 int samplesPerSec); 115 int samplesPerSec);
168 int32_t RecordAudioToFile(uint32_t mixingFrequency);
169
170 int32_t MixOrReplaceAudioWithFile(
171 int mixingFrequency);
172 116
173 void ProcessAudio(int delay_ms, int clock_drift, int current_mic_level, 117 void ProcessAudio(int delay_ms, int clock_drift, int current_mic_level,
174 bool key_pressed); 118 bool key_pressed);
175 119
176 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION 120 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
177 void TypingDetection(bool keyPressed); 121 void TypingDetection(bool keyPressed);
178 #endif 122 #endif
179 123
180 // uses 124 // uses
181 Statistics* _engineStatisticsPtr = nullptr; 125 Statistics* _engineStatisticsPtr = nullptr;
182 ChannelManager* _channelManagerPtr = nullptr; 126 ChannelManager* _channelManagerPtr = nullptr;
183 AudioProcessing* audioproc_ = nullptr; 127 AudioProcessing* audioproc_ = nullptr;
184 VoiceEngineObserver* _voiceEngineObserverPtr = nullptr; 128 VoiceEngineObserver* _voiceEngineObserverPtr = nullptr;
185 ProcessThread* _processThreadPtr = nullptr; 129 ProcessThread* _processThreadPtr = nullptr;
186 130
187 // owns 131 // owns
188 AudioFrame _audioFrame; 132 AudioFrame _audioFrame;
189 PushResampler<int16_t> resampler_; // ADM sample rate -> mixing rate 133 PushResampler<int16_t> resampler_; // ADM sample rate -> mixing rate
190 std::unique_ptr<FilePlayer> file_player_;
191 std::unique_ptr<FileRecorder> file_recorder_;
192 std::unique_ptr<FileRecorder> file_call_recorder_;
193 int _filePlayerId = 0;
194 int _fileRecorderId = 0;
195 int _fileCallRecorderId = 0;
196 bool _filePlaying = false;
197 bool _fileRecording = false;
198 bool _fileCallRecording = false;
199 voe::AudioLevel _audioLevel; 134 voe::AudioLevel _audioLevel;
200 // protect file instances and their variables in MixedParticipants() 135 // protect file instances and their variables in MixedParticipants()
201 rtc::CriticalSection _critSect; 136 rtc::CriticalSection _critSect;
202 rtc::CriticalSection _callbackCritSect; 137 rtc::CriticalSection _callbackCritSect;
203 138
204 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION 139 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
205 MonitorModule<TransmitMixer> _monitorModule; 140 MonitorModule<TransmitMixer> _monitorModule;
206 webrtc::TypingDetection _typingDetection; 141 webrtc::TypingDetection _typingDetection;
207 bool _typingNoiseWarningPending = false; 142 bool _typingNoiseWarningPending = false;
208 bool _typingNoiseDetected = false; 143 bool _typingNoiseDetected = false;
209 #endif 144 #endif
210 145
211 int _instanceId = 0; 146 int _instanceId = 0;
212 bool _mixFileWithMicrophone = false;
213 uint32_t _captureLevel = 0; 147 uint32_t _captureLevel = 0;
214 bool stereo_codec_ = false; 148 bool stereo_codec_ = false;
215 bool swap_stereo_channels_ = false; 149 bool swap_stereo_channels_ = false;
216 }; 150 };
217 } // namespace voe 151 } // namespace voe
218 } // namespace webrtc 152 } // namespace webrtc
219 153
220 #endif // VOICE_ENGINE_TRANSMIT_MIXER_H_ 154 #endif // VOICE_ENGINE_TRANSMIT_MIXER_H_
OLDNEW
« no previous file with comments | « voice_engine/output_mixer.cc ('k') | voice_engine/transmit_mixer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698