| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "webrtc/call.h" | 46 #include "webrtc/call.h" |
| 47 #include "webrtc/common.h" | 47 #include "webrtc/common.h" |
| 48 #include "webrtc/config.h" | 48 #include "webrtc/config.h" |
| 49 | 49 |
| 50 namespace webrtc { | 50 namespace webrtc { |
| 51 class VideoEngine; | 51 class VideoEngine; |
| 52 } | 52 } |
| 53 | 53 |
| 54 namespace cricket { | 54 namespace cricket { |
| 55 | 55 |
| 56 // WebRtcMonitorStream is used to monitor a stream coming from WebRtc. | |
| 57 // For now we just dump the data. | |
| 58 class WebRtcMonitorStream : public webrtc::OutStream { | |
| 59 bool Write(const void* buf, size_t len) override { return true; } | |
| 60 }; | |
| 61 | |
| 62 class AudioDeviceModule; | 56 class AudioDeviceModule; |
| 63 class AudioRenderer; | 57 class AudioRenderer; |
| 64 class VoETraceWrapper; | 58 class VoETraceWrapper; |
| 65 class VoEWrapper; | 59 class VoEWrapper; |
| 66 class VoiceProcessor; | 60 class VoiceProcessor; |
| 67 class WebRtcVoiceMediaChannel; | 61 class WebRtcVoiceMediaChannel; |
| 68 | 62 |
| 69 // WebRtcVoiceEngine is a class to be used with CompositeMediaEngine. | 63 // WebRtcVoiceEngine is a class to be used with CompositeMediaEngine. |
| 70 // It uses the WebRtc VoiceEngine library for audio handling. | 64 // It uses the WebRtc VoiceEngine library for audio handling. |
| 71 class WebRtcVoiceEngine | 65 class WebRtcVoiceEngine |
| (...skipping 15 matching lines...) Expand all Loading... |
| 87 VoiceMediaChannel* CreateChannel(webrtc::Call* call, | 81 VoiceMediaChannel* CreateChannel(webrtc::Call* call, |
| 88 const AudioOptions& options); | 82 const AudioOptions& options); |
| 89 | 83 |
| 90 AudioOptions GetOptions() const { return options_; } | 84 AudioOptions GetOptions() const { return options_; } |
| 91 bool SetOptions(const AudioOptions& options); | 85 bool SetOptions(const AudioOptions& options); |
| 92 bool SetDelayOffset(int offset); | 86 bool SetDelayOffset(int offset); |
| 93 bool SetDevices(const Device* in_device, const Device* out_device); | 87 bool SetDevices(const Device* in_device, const Device* out_device); |
| 94 bool GetOutputVolume(int* level); | 88 bool GetOutputVolume(int* level); |
| 95 bool SetOutputVolume(int level); | 89 bool SetOutputVolume(int level); |
| 96 int GetInputLevel(); | 90 int GetInputLevel(); |
| 97 bool SetLocalMonitor(bool enable); | |
| 98 | 91 |
| 99 const std::vector<AudioCodec>& codecs(); | 92 const std::vector<AudioCodec>& codecs(); |
| 100 bool FindCodec(const AudioCodec& codec); | 93 bool FindCodec(const AudioCodec& codec); |
| 101 bool FindWebRtcCodec(const AudioCodec& codec, webrtc::CodecInst* gcodec); | 94 bool FindWebRtcCodec(const AudioCodec& codec, webrtc::CodecInst* gcodec); |
| 102 | 95 |
| 103 const std::vector<RtpHeaderExtension>& rtp_header_extensions() const; | 96 const std::vector<RtpHeaderExtension>& rtp_header_extensions() const; |
| 104 | 97 |
| 105 void SetLogging(int min_sev, const char* filter); | 98 void SetLogging(int min_sev, const char* filter); |
| 106 | 99 |
| 107 bool RegisterProcessor(uint32 ssrc, | 100 bool RegisterProcessor(uint32 ssrc, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // Given the device type, name, and id, find device id. Return true and | 176 // Given the device type, name, and id, find device id. Return true and |
| 184 // set the output parameter rtc_id if successful. | 177 // set the output parameter rtc_id if successful. |
| 185 bool FindWebRtcAudioDeviceId( | 178 bool FindWebRtcAudioDeviceId( |
| 186 bool is_input, const std::string& dev_name, int dev_id, int* rtc_id); | 179 bool is_input, const std::string& dev_name, int dev_id, int* rtc_id); |
| 187 bool FindChannelAndSsrc(int channel_num, | 180 bool FindChannelAndSsrc(int channel_num, |
| 188 WebRtcVoiceMediaChannel** channel, | 181 WebRtcVoiceMediaChannel** channel, |
| 189 uint32* ssrc) const; | 182 uint32* ssrc) const; |
| 190 bool FindChannelNumFromSsrc(uint32 ssrc, | 183 bool FindChannelNumFromSsrc(uint32 ssrc, |
| 191 MediaProcessorDirection direction, | 184 MediaProcessorDirection direction, |
| 192 int* channel_num); | 185 int* channel_num); |
| 193 bool ChangeLocalMonitor(bool enable); | |
| 194 bool PauseLocalMonitor(); | |
| 195 bool ResumeLocalMonitor(); | |
| 196 | 186 |
| 197 bool UnregisterProcessorChannel(MediaProcessorDirection channel_direction, | 187 bool UnregisterProcessorChannel(MediaProcessorDirection channel_direction, |
| 198 uint32 ssrc, | 188 uint32 ssrc, |
| 199 VoiceProcessor* voice_processor, | 189 VoiceProcessor* voice_processor, |
| 200 MediaProcessorDirection processor_direction); | 190 MediaProcessorDirection processor_direction); |
| 201 | 191 |
| 202 void StartAecDump(const std::string& filename); | 192 void StartAecDump(const std::string& filename); |
| 203 void StopAecDump(); | 193 void StopAecDump(); |
| 204 int CreateVoiceChannel(VoEWrapper* voe); | 194 int CreateVoiceChannel(VoEWrapper* voe); |
| 205 | 195 |
| 206 // When a voice processor registers with the engine, it is connected | 196 // When a voice processor registers with the engine, it is connected |
| 207 // to either the Rx or Tx signals, based on the direction parameter. | 197 // to either the Rx or Tx signals, based on the direction parameter. |
| 208 // SignalXXMediaFrame will be invoked for every audio packet. | 198 // SignalXXMediaFrame will be invoked for every audio packet. |
| 209 FrameSignal SignalRxMediaFrame; | 199 FrameSignal SignalRxMediaFrame; |
| 210 FrameSignal SignalTxMediaFrame; | 200 FrameSignal SignalTxMediaFrame; |
| 211 | 201 |
| 212 static const int kDefaultLogSeverity = rtc::LS_WARNING; | 202 static const int kDefaultLogSeverity = rtc::LS_WARNING; |
| 213 | 203 |
| 214 // The primary instance of WebRtc VoiceEngine. | 204 // The primary instance of WebRtc VoiceEngine. |
| 215 rtc::scoped_ptr<VoEWrapper> voe_wrapper_; | 205 rtc::scoped_ptr<VoEWrapper> voe_wrapper_; |
| 216 rtc::scoped_ptr<VoETraceWrapper> tracing_; | 206 rtc::scoped_ptr<VoETraceWrapper> tracing_; |
| 217 // The external audio device manager | 207 // The external audio device manager |
| 218 webrtc::AudioDeviceModule* adm_; | 208 webrtc::AudioDeviceModule* adm_; |
| 219 int log_filter_; | 209 int log_filter_; |
| 220 std::string log_options_; | 210 std::string log_options_; |
| 221 bool is_dumping_aec_; | 211 bool is_dumping_aec_; |
| 222 std::vector<AudioCodec> codecs_; | 212 std::vector<AudioCodec> codecs_; |
| 223 std::vector<RtpHeaderExtension> rtp_header_extensions_; | 213 std::vector<RtpHeaderExtension> rtp_header_extensions_; |
| 224 bool desired_local_monitor_enable_; | |
| 225 rtc::scoped_ptr<WebRtcMonitorStream> monitor_; | |
| 226 ChannelList channels_; | 214 ChannelList channels_; |
| 227 // channels_ can be read from WebRtc callback thread. We need a lock on that | 215 // channels_ can be read from WebRtc callback thread. We need a lock on that |
| 228 // callback as well as the RegisterChannel/UnregisterChannel. | 216 // callback as well as the RegisterChannel/UnregisterChannel. |
| 229 rtc::CriticalSection channels_cs_; | 217 rtc::CriticalSection channels_cs_; |
| 230 webrtc::AgcConfig default_agc_config_; | 218 webrtc::AgcConfig default_agc_config_; |
| 231 | 219 |
| 232 webrtc::Config voe_config_; | 220 webrtc::Config voe_config_; |
| 233 | 221 |
| 234 bool initialized_; | 222 bool initialized_; |
| 235 // See SetOptions and SetOptionOverrides for a description of the | 223 // See SetOptions and SetOptionOverrides for a description of the |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 424 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
| 437 | 425 |
| 438 // Do not lock this on the VoE media processor thread; potential for deadlock | 426 // Do not lock this on the VoE media processor thread; potential for deadlock |
| 439 // exists. | 427 // exists. |
| 440 mutable rtc::CriticalSection receive_channels_cs_; | 428 mutable rtc::CriticalSection receive_channels_cs_; |
| 441 }; | 429 }; |
| 442 | 430 |
| 443 } // namespace cricket | 431 } // namespace cricket |
| 444 | 432 |
| 445 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ | 433 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ |
| OLD | NEW |