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

Side by Side Diff: webrtc/media/base/mediachannel.h

Issue 1646253004: Split out dscp option from VideoOptions to new struct MediaChannelOptions. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 10 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 | « webrtc/media/base/fakemediaengine.h ('k') | webrtc/media/base/mediaengine.h » ('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 * 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 for (size_t i = 0; i < vals.size(); ++i) { 88 for (size_t i = 0; i < vals.size(); ++i) {
89 if (i > 0) { 89 if (i > 0) {
90 ost << ", "; 90 ost << ", ";
91 } 91 }
92 ost << vals[i].ToString(); 92 ost << vals[i].ToString();
93 } 93 }
94 ost << "]"; 94 ost << "]";
95 return ost.str(); 95 return ost.str();
96 } 96 }
97 97
98 struct MediaChannelOptions {
99 // Set DSCP value for packet sent from media channel. This flag
100 // comes from the PeerConnection constraint 'googDscp'.
101 bool enable_dscp = false;
102 };
103
98 // Options that can be applied to a VoiceMediaChannel or a VoiceMediaEngine. 104 // Options that can be applied to a VoiceMediaChannel or a VoiceMediaEngine.
99 // Used to be flags, but that makes it hard to selectively apply options. 105 // Used to be flags, but that makes it hard to selectively apply options.
100 // We are moving all of the setting of options to structs like this, 106 // We are moving all of the setting of options to structs like this,
101 // but some things currently still use flags. 107 // but some things currently still use flags.
102 struct AudioOptions { 108 struct AudioOptions {
103 void SetAll(const AudioOptions& change) { 109 void SetAll(const AudioOptions& change) {
104 SetFrom(&echo_cancellation, change.echo_cancellation); 110 SetFrom(&echo_cancellation, change.echo_cancellation);
105 SetFrom(&auto_gain_control, change.auto_gain_control); 111 SetFrom(&auto_gain_control, change.auto_gain_control);
106 SetFrom(&noise_suppression, change.noise_suppression); 112 SetFrom(&noise_suppression, change.noise_suppression);
107 SetFrom(&highpass_filter, change.highpass_filter); 113 SetFrom(&highpass_filter, change.highpass_filter);
(...skipping 10 matching lines...) Expand all
118 SetFrom(&extended_filter_aec, change.extended_filter_aec); 124 SetFrom(&extended_filter_aec, change.extended_filter_aec);
119 SetFrom(&delay_agnostic_aec, change.delay_agnostic_aec); 125 SetFrom(&delay_agnostic_aec, change.delay_agnostic_aec);
120 SetFrom(&experimental_ns, change.experimental_ns); 126 SetFrom(&experimental_ns, change.experimental_ns);
121 SetFrom(&aec_dump, change.aec_dump); 127 SetFrom(&aec_dump, change.aec_dump);
122 SetFrom(&tx_agc_target_dbov, change.tx_agc_target_dbov); 128 SetFrom(&tx_agc_target_dbov, change.tx_agc_target_dbov);
123 SetFrom(&tx_agc_digital_compression_gain, 129 SetFrom(&tx_agc_digital_compression_gain,
124 change.tx_agc_digital_compression_gain); 130 change.tx_agc_digital_compression_gain);
125 SetFrom(&tx_agc_limiter, change.tx_agc_limiter); 131 SetFrom(&tx_agc_limiter, change.tx_agc_limiter);
126 SetFrom(&recording_sample_rate, change.recording_sample_rate); 132 SetFrom(&recording_sample_rate, change.recording_sample_rate);
127 SetFrom(&playout_sample_rate, change.playout_sample_rate); 133 SetFrom(&playout_sample_rate, change.playout_sample_rate);
128 SetFrom(&dscp, change.dscp);
129 SetFrom(&combined_audio_video_bwe, change.combined_audio_video_bwe); 134 SetFrom(&combined_audio_video_bwe, change.combined_audio_video_bwe);
130 } 135 }
131 136
132 bool operator==(const AudioOptions& o) const { 137 bool operator==(const AudioOptions& o) const {
133 return echo_cancellation == o.echo_cancellation && 138 return echo_cancellation == o.echo_cancellation &&
134 auto_gain_control == o.auto_gain_control && 139 auto_gain_control == o.auto_gain_control &&
135 noise_suppression == o.noise_suppression && 140 noise_suppression == o.noise_suppression &&
136 highpass_filter == o.highpass_filter && 141 highpass_filter == o.highpass_filter &&
137 stereo_swapping == o.stereo_swapping && 142 stereo_swapping == o.stereo_swapping &&
138 audio_jitter_buffer_max_packets == o.audio_jitter_buffer_max_packets && 143 audio_jitter_buffer_max_packets == o.audio_jitter_buffer_max_packets &&
139 audio_jitter_buffer_fast_accelerate == 144 audio_jitter_buffer_fast_accelerate ==
140 o.audio_jitter_buffer_fast_accelerate && 145 o.audio_jitter_buffer_fast_accelerate &&
141 typing_detection == o.typing_detection && 146 typing_detection == o.typing_detection &&
142 aecm_generate_comfort_noise == o.aecm_generate_comfort_noise && 147 aecm_generate_comfort_noise == o.aecm_generate_comfort_noise &&
143 conference_mode == o.conference_mode && 148 conference_mode == o.conference_mode &&
144 experimental_agc == o.experimental_agc && 149 experimental_agc == o.experimental_agc &&
145 extended_filter_aec == o.extended_filter_aec && 150 extended_filter_aec == o.extended_filter_aec &&
146 delay_agnostic_aec == o.delay_agnostic_aec && 151 delay_agnostic_aec == o.delay_agnostic_aec &&
147 experimental_ns == o.experimental_ns && 152 experimental_ns == o.experimental_ns &&
148 adjust_agc_delta == o.adjust_agc_delta && 153 adjust_agc_delta == o.adjust_agc_delta &&
149 aec_dump == o.aec_dump && 154 aec_dump == o.aec_dump &&
150 tx_agc_target_dbov == o.tx_agc_target_dbov && 155 tx_agc_target_dbov == o.tx_agc_target_dbov &&
151 tx_agc_digital_compression_gain == o.tx_agc_digital_compression_gain && 156 tx_agc_digital_compression_gain == o.tx_agc_digital_compression_gain &&
152 tx_agc_limiter == o.tx_agc_limiter && 157 tx_agc_limiter == o.tx_agc_limiter &&
153 recording_sample_rate == o.recording_sample_rate && 158 recording_sample_rate == o.recording_sample_rate &&
154 playout_sample_rate == o.playout_sample_rate && 159 playout_sample_rate == o.playout_sample_rate &&
155 dscp == o.dscp &&
156 combined_audio_video_bwe == o.combined_audio_video_bwe; 160 combined_audio_video_bwe == o.combined_audio_video_bwe;
157 } 161 }
158 162
159 std::string ToString() const { 163 std::string ToString() const {
160 std::ostringstream ost; 164 std::ostringstream ost;
161 ost << "AudioOptions {"; 165 ost << "AudioOptions {";
162 ost << ToStringIfSet("aec", echo_cancellation); 166 ost << ToStringIfSet("aec", echo_cancellation);
163 ost << ToStringIfSet("agc", auto_gain_control); 167 ost << ToStringIfSet("agc", auto_gain_control);
164 ost << ToStringIfSet("ns", noise_suppression); 168 ost << ToStringIfSet("ns", noise_suppression);
165 ost << ToStringIfSet("hf", highpass_filter); 169 ost << ToStringIfSet("hf", highpass_filter);
(...skipping 10 matching lines...) Expand all
176 ost << ToStringIfSet("extended_filter_aec", extended_filter_aec); 180 ost << ToStringIfSet("extended_filter_aec", extended_filter_aec);
177 ost << ToStringIfSet("delay_agnostic_aec", delay_agnostic_aec); 181 ost << ToStringIfSet("delay_agnostic_aec", delay_agnostic_aec);
178 ost << ToStringIfSet("experimental_ns", experimental_ns); 182 ost << ToStringIfSet("experimental_ns", experimental_ns);
179 ost << ToStringIfSet("aec_dump", aec_dump); 183 ost << ToStringIfSet("aec_dump", aec_dump);
180 ost << ToStringIfSet("tx_agc_target_dbov", tx_agc_target_dbov); 184 ost << ToStringIfSet("tx_agc_target_dbov", tx_agc_target_dbov);
181 ost << ToStringIfSet("tx_agc_digital_compression_gain", 185 ost << ToStringIfSet("tx_agc_digital_compression_gain",
182 tx_agc_digital_compression_gain); 186 tx_agc_digital_compression_gain);
183 ost << ToStringIfSet("tx_agc_limiter", tx_agc_limiter); 187 ost << ToStringIfSet("tx_agc_limiter", tx_agc_limiter);
184 ost << ToStringIfSet("recording_sample_rate", recording_sample_rate); 188 ost << ToStringIfSet("recording_sample_rate", recording_sample_rate);
185 ost << ToStringIfSet("playout_sample_rate", playout_sample_rate); 189 ost << ToStringIfSet("playout_sample_rate", playout_sample_rate);
186 ost << ToStringIfSet("dscp", dscp);
187 ost << ToStringIfSet("combined_audio_video_bwe", combined_audio_video_bwe); 190 ost << ToStringIfSet("combined_audio_video_bwe", combined_audio_video_bwe);
188 ost << "}"; 191 ost << "}";
189 return ost.str(); 192 return ost.str();
190 } 193 }
191 194
192 // Audio processing that attempts to filter away the output signal from 195 // Audio processing that attempts to filter away the output signal from
193 // later inbound pickup. 196 // later inbound pickup.
194 rtc::Optional<bool> echo_cancellation; 197 rtc::Optional<bool> echo_cancellation;
195 // Audio processing to adjust the sensitivity of the local mic dynamically. 198 // Audio processing to adjust the sensitivity of the local mic dynamically.
196 rtc::Optional<bool> auto_gain_control; 199 rtc::Optional<bool> auto_gain_control;
(...skipping 16 matching lines...) Expand all
213 rtc::Optional<bool> extended_filter_aec; 216 rtc::Optional<bool> extended_filter_aec;
214 rtc::Optional<bool> delay_agnostic_aec; 217 rtc::Optional<bool> delay_agnostic_aec;
215 rtc::Optional<bool> experimental_ns; 218 rtc::Optional<bool> experimental_ns;
216 rtc::Optional<bool> aec_dump; 219 rtc::Optional<bool> aec_dump;
217 // Note that tx_agc_* only applies to non-experimental AGC. 220 // Note that tx_agc_* only applies to non-experimental AGC.
218 rtc::Optional<uint16_t> tx_agc_target_dbov; 221 rtc::Optional<uint16_t> tx_agc_target_dbov;
219 rtc::Optional<uint16_t> tx_agc_digital_compression_gain; 222 rtc::Optional<uint16_t> tx_agc_digital_compression_gain;
220 rtc::Optional<bool> tx_agc_limiter; 223 rtc::Optional<bool> tx_agc_limiter;
221 rtc::Optional<uint32_t> recording_sample_rate; 224 rtc::Optional<uint32_t> recording_sample_rate;
222 rtc::Optional<uint32_t> playout_sample_rate; 225 rtc::Optional<uint32_t> playout_sample_rate;
223 // Set DSCP value for packet sent from audio channel.
224 rtc::Optional<bool> dscp;
225 // Enable combined audio+bandwidth BWE. 226 // Enable combined audio+bandwidth BWE.
226 rtc::Optional<bool> combined_audio_video_bwe; 227 rtc::Optional<bool> combined_audio_video_bwe;
227 228
228 private: 229 private:
229 template <typename T> 230 template <typename T>
230 static void SetFrom(rtc::Optional<T>* s, const rtc::Optional<T>& o) { 231 static void SetFrom(rtc::Optional<T>* s, const rtc::Optional<T>& o) {
231 if (o) { 232 if (o) {
232 *s = o; 233 *s = o;
233 } 234 }
234 } 235 }
235 }; 236 };
236 237
237 // Options that can be applied to a VideoMediaChannel or a VideoMediaEngine. 238 // Options that can be applied to a VideoMediaChannel or a VideoMediaEngine.
238 // Used to be flags, but that makes it hard to selectively apply options. 239 // Used to be flags, but that makes it hard to selectively apply options.
239 // We are moving all of the setting of options to structs like this, 240 // We are moving all of the setting of options to structs like this,
240 // but some things currently still use flags. 241 // but some things currently still use flags.
241 struct VideoOptions { 242 struct VideoOptions {
242 void SetAll(const VideoOptions& change) { 243 void SetAll(const VideoOptions& change) {
243 SetFrom(&video_noise_reduction, change.video_noise_reduction); 244 SetFrom(&video_noise_reduction, change.video_noise_reduction);
244 SetFrom(&cpu_overuse_detection, change.cpu_overuse_detection); 245 SetFrom(&cpu_overuse_detection, change.cpu_overuse_detection);
245 SetFrom(&conference_mode, change.conference_mode); 246 SetFrom(&conference_mode, change.conference_mode);
246 SetFrom(&dscp, change.dscp);
247 SetFrom(&suspend_below_min_bitrate, change.suspend_below_min_bitrate); 247 SetFrom(&suspend_below_min_bitrate, change.suspend_below_min_bitrate);
248 SetFrom(&screencast_min_bitrate_kbps, change.screencast_min_bitrate_kbps); 248 SetFrom(&screencast_min_bitrate_kbps, change.screencast_min_bitrate_kbps);
249 SetFrom(&disable_prerenderer_smoothing, 249 SetFrom(&disable_prerenderer_smoothing,
250 change.disable_prerenderer_smoothing); 250 change.disable_prerenderer_smoothing);
251 } 251 }
252 252
253 bool operator==(const VideoOptions& o) const { 253 bool operator==(const VideoOptions& o) const {
254 return video_noise_reduction == o.video_noise_reduction && 254 return video_noise_reduction == o.video_noise_reduction &&
255 cpu_overuse_detection == o.cpu_overuse_detection && 255 cpu_overuse_detection == o.cpu_overuse_detection &&
256 conference_mode == o.conference_mode && 256 conference_mode == o.conference_mode &&
257 dscp == o.dscp &&
258 suspend_below_min_bitrate == o.suspend_below_min_bitrate && 257 suspend_below_min_bitrate == o.suspend_below_min_bitrate &&
259 screencast_min_bitrate_kbps == o.screencast_min_bitrate_kbps && 258 screencast_min_bitrate_kbps == o.screencast_min_bitrate_kbps &&
260 disable_prerenderer_smoothing == o.disable_prerenderer_smoothing; 259 disable_prerenderer_smoothing == o.disable_prerenderer_smoothing;
261 } 260 }
262 261
263 std::string ToString() const { 262 std::string ToString() const {
264 std::ostringstream ost; 263 std::ostringstream ost;
265 ost << "VideoOptions {"; 264 ost << "VideoOptions {";
266 ost << ToStringIfSet("noise reduction", video_noise_reduction); 265 ost << ToStringIfSet("noise reduction", video_noise_reduction);
267 ost << ToStringIfSet("cpu overuse detection", cpu_overuse_detection); 266 ost << ToStringIfSet("cpu overuse detection", cpu_overuse_detection);
268 ost << ToStringIfSet("conference mode", conference_mode); 267 ost << ToStringIfSet("conference mode", conference_mode);
269 ost << ToStringIfSet("dscp", dscp);
270 ost << ToStringIfSet("suspend below min bitrate", 268 ost << ToStringIfSet("suspend below min bitrate",
271 suspend_below_min_bitrate); 269 suspend_below_min_bitrate);
272 ost << ToStringIfSet("screencast min bitrate kbps", 270 ost << ToStringIfSet("screencast min bitrate kbps",
273 screencast_min_bitrate_kbps); 271 screencast_min_bitrate_kbps);
274 ost << "}"; 272 ost << "}";
275 return ost.str(); 273 return ost.str();
276 } 274 }
277 275
278 // Enable denoising? This flag comes from the getUserMedia 276 // Enable denoising? This flag comes from the getUserMedia
279 // constraint 'googNoiseReduction', and WebRtcVideoEngine2 passes it 277 // constraint 'googNoiseReduction', and WebRtcVideoEngine2 passes it
280 // on to the codec options. Disabled by default. 278 // on to the codec options. Disabled by default.
281 rtc::Optional<bool> video_noise_reduction; 279 rtc::Optional<bool> video_noise_reduction;
282 // Enable WebRTC Cpu Overuse Detection. This flag comes from the 280 // Enable WebRTC Cpu Overuse Detection. This flag comes from the
283 // PeerConnection constraint 'googCpuOveruseDetection' and is 281 // PeerConnection constraint 'googCpuOveruseDetection' and is
284 // checked in WebRtcVideoChannel2::OnLoadUpdate, where it's passed 282 // checked in WebRtcVideoChannel2::OnLoadUpdate, where it's passed
285 // to VideoCapturer::video_adapter()->OnCpuResolutionRequest. 283 // to VideoCapturer::video_adapter()->OnCpuResolutionRequest.
286 rtc::Optional<bool> cpu_overuse_detection; 284 rtc::Optional<bool> cpu_overuse_detection;
287 // Use conference mode? This flag comes from the remote 285 // Use conference mode? This flag comes from the remote
288 // description's SDP line 'a=x-google-flag:conference', copied over 286 // description's SDP line 'a=x-google-flag:conference', copied over
289 // by VideoChannel::SetRemoteContent_w, and ultimately used by 287 // by VideoChannel::SetRemoteContent_w, and ultimately used by
290 // conference mode screencast logic in 288 // conference mode screencast logic in
291 // WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoderConfig. 289 // WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoderConfig.
292 // The special screencast behaviour is disabled by default. 290 // The special screencast behaviour is disabled by default.
293 rtc::Optional<bool> conference_mode; 291 rtc::Optional<bool> conference_mode;
294 // Set DSCP value for packet sent from video channel. This flag
295 // comes from the PeerConnection constraint 'googDscp' and,
296 // WebRtcVideoChannel2::SetOptions checks it before calling
297 // MediaChannel::SetDscp. If enabled, rtc::DSCP_AF41 is used. If
298 // disabled, which is the default, rtc::DSCP_DEFAULT is used.
299 rtc::Optional<bool> dscp;
300 // Enable WebRTC suspension of video. No video frames will be sent 292 // Enable WebRTC suspension of video. No video frames will be sent
301 // when the bitrate is below the configured minimum bitrate. This 293 // when the bitrate is below the configured minimum bitrate. This
302 // flag comes from the PeerConnection constraint 294 // flag comes from the PeerConnection constraint
303 // 'googSuspendBelowMinBitrate', and WebRtcVideoChannel2 copies it 295 // 'googSuspendBelowMinBitrate', and WebRtcVideoChannel2 copies it
304 // to VideoSendStream::Config::suspend_below_min_bitrate. 296 // to VideoSendStream::Config::suspend_below_min_bitrate.
305 rtc::Optional<bool> suspend_below_min_bitrate; 297 rtc::Optional<bool> suspend_below_min_bitrate;
306 // Force screencast to use a minimum bitrate. This flag comes from 298 // Force screencast to use a minimum bitrate. This flag comes from
307 // the PeerConnection constraint 'googScreencastMinBitrate'. It is 299 // the PeerConnection constraint 'googScreencastMinBitrate'. It is
308 // copied to the encoder config by WebRtcVideoChannel2. 300 // copied to the encoder config by WebRtcVideoChannel2.
309 rtc::Optional<int> screencast_min_bitrate_kbps; 301 rtc::Optional<int> screencast_min_bitrate_kbps;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 enum SocketType { ST_RTP, ST_RTCP }; 370 enum SocketType { ST_RTP, ST_RTCP };
379 virtual bool SendPacket(rtc::Buffer* packet, 371 virtual bool SendPacket(rtc::Buffer* packet,
380 const rtc::PacketOptions& options) = 0; 372 const rtc::PacketOptions& options) = 0;
381 virtual bool SendRtcp(rtc::Buffer* packet, 373 virtual bool SendRtcp(rtc::Buffer* packet,
382 const rtc::PacketOptions& options) = 0; 374 const rtc::PacketOptions& options) = 0;
383 virtual int SetOption(SocketType type, rtc::Socket::Option opt, 375 virtual int SetOption(SocketType type, rtc::Socket::Option opt,
384 int option) = 0; 376 int option) = 0;
385 virtual ~NetworkInterface() {} 377 virtual ~NetworkInterface() {}
386 }; 378 };
387 379
388 MediaChannel() : network_interface_(NULL) {} 380 MediaChannel(const MediaChannelOptions& options)
381 : options_(options), network_interface_(NULL) {}
389 virtual ~MediaChannel() {} 382 virtual ~MediaChannel() {}
390 383
391 // Sets the abstract interface class for sending RTP/RTCP data. 384 // Sets the abstract interface class for sending RTP/RTCP data.
392 virtual void SetInterface(NetworkInterface *iface) { 385 virtual void SetInterface(NetworkInterface *iface) {
393 rtc::CritScope cs(&network_interface_crit_); 386 rtc::CritScope cs(&network_interface_crit_);
394 network_interface_ = iface; 387 network_interface_ = iface;
388 SetDscp(options_.enable_dscp ? MediaTypeDscpValue() : rtc::DSCP_DEFAULT);
389 }
390 virtual rtc::DiffServCodePoint MediaTypeDscpValue() const {
391 return rtc::DSCP_DEFAULT;
395 } 392 }
396 393
397 // Called when a RTP packet is received. 394 // Called when a RTP packet is received.
398 virtual void OnPacketReceived(rtc::Buffer* packet, 395 virtual void OnPacketReceived(rtc::Buffer* packet,
399 const rtc::PacketTime& packet_time) = 0; 396 const rtc::PacketTime& packet_time) = 0;
400 // Called when a RTCP packet is received. 397 // Called when a RTCP packet is received.
401 virtual void OnRtcpReceived(rtc::Buffer* packet, 398 virtual void OnRtcpReceived(rtc::Buffer* packet,
402 const rtc::PacketTime& packet_time) = 0; 399 const rtc::PacketTime& packet_time) = 0;
403 // Called when the socket's ability to send has changed. 400 // Called when the socket's ability to send has changed.
404 virtual void OnReadyToSend(bool ready) = 0; 401 virtual void OnReadyToSend(bool ready) = 0;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 bool rtcp, 458 bool rtcp,
462 const rtc::PacketOptions& options) { 459 const rtc::PacketOptions& options) {
463 rtc::CritScope cs(&network_interface_crit_); 460 rtc::CritScope cs(&network_interface_crit_);
464 if (!network_interface_) 461 if (!network_interface_)
465 return false; 462 return false;
466 463
467 return (!rtcp) ? network_interface_->SendPacket(packet, options) 464 return (!rtcp) ? network_interface_->SendPacket(packet, options)
468 : network_interface_->SendRtcp(packet, options); 465 : network_interface_->SendRtcp(packet, options);
469 } 466 }
470 467
468 const MediaChannelOptions options_;
471 // |network_interface_| can be accessed from the worker_thread and 469 // |network_interface_| can be accessed from the worker_thread and
472 // from any MediaEngine threads. This critical section is to protect accessing 470 // from any MediaEngine threads. This critical section is to protect accessing
473 // of network_interface_ object. 471 // of network_interface_ object.
474 rtc::CriticalSection network_interface_crit_; 472 rtc::CriticalSection network_interface_crit_;
475 NetworkInterface* network_interface_; 473 NetworkInterface* network_interface_;
476 }; 474 };
477 475
478 enum SendFlags { 476 enum SendFlags {
479 SEND_NOTHING, 477 SEND_NOTHING,
480 SEND_MICROPHONE 478 SEND_MICROPHONE
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 ERROR_REC_TYPING_NOISE_DETECTED, // Typing noise is detected. 911 ERROR_REC_TYPING_NOISE_DETECTED, // Typing noise is detected.
914 ERROR_PLAY_DEVICE_OPEN_FAILED = 200, // Could not open playout. 912 ERROR_PLAY_DEVICE_OPEN_FAILED = 200, // Could not open playout.
915 ERROR_PLAY_DEVICE_MUTED, // Playout muted by OS. 913 ERROR_PLAY_DEVICE_MUTED, // Playout muted by OS.
916 ERROR_PLAY_DEVICE_REMOVED, // Playout removed while active. 914 ERROR_PLAY_DEVICE_REMOVED, // Playout removed while active.
917 ERROR_PLAY_RUNTIME_ERROR, // Errors in voice processing. 915 ERROR_PLAY_RUNTIME_ERROR, // Errors in voice processing.
918 ERROR_PLAY_SRTP_ERROR, // Generic SRTP failure. 916 ERROR_PLAY_SRTP_ERROR, // Generic SRTP failure.
919 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. 917 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets.
920 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. 918 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected.
921 }; 919 };
922 920
923 VoiceMediaChannel() {} 921 VoiceMediaChannel(const MediaChannelOptions& options)
922 : MediaChannel(options) {}
923
924 virtual ~VoiceMediaChannel() {} 924 virtual ~VoiceMediaChannel() {}
925 virtual bool SetSendParameters(const AudioSendParameters& params) = 0; 925 virtual bool SetSendParameters(const AudioSendParameters& params) = 0;
926 virtual bool SetRecvParameters(const AudioRecvParameters& params) = 0; 926 virtual bool SetRecvParameters(const AudioRecvParameters& params) = 0;
927 // Starts or stops playout of received audio. 927 // Starts or stops playout of received audio.
928 virtual bool SetPlayout(bool playout) = 0; 928 virtual bool SetPlayout(bool playout) = 0;
929 // Starts or stops sending (and potentially capture) of local audio. 929 // Starts or stops sending (and potentially capture) of local audio.
930 virtual bool SetSend(SendFlags flag) = 0; 930 virtual bool SetSend(SendFlags flag) = 0;
931 // Configure stream for sending. 931 // Configure stream for sending.
932 virtual bool SetAudioSend(uint32_t ssrc, 932 virtual bool SetAudioSend(uint32_t ssrc,
933 bool enable, 933 bool enable,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 ERROR_REC_DEVICE_IN_USE, // Device is in already use. 976 ERROR_REC_DEVICE_IN_USE, // Device is in already use.
977 ERROR_REC_DEVICE_REMOVED, // Device is removed. 977 ERROR_REC_DEVICE_REMOVED, // Device is removed.
978 ERROR_REC_SRTP_ERROR, // Generic sender SRTP failure. 978 ERROR_REC_SRTP_ERROR, // Generic sender SRTP failure.
979 ERROR_REC_SRTP_AUTH_FAILED, // Failed to authenticate packets. 979 ERROR_REC_SRTP_AUTH_FAILED, // Failed to authenticate packets.
980 ERROR_REC_CPU_MAX_CANT_DOWNGRADE, // Can't downgrade capture anymore. 980 ERROR_REC_CPU_MAX_CANT_DOWNGRADE, // Can't downgrade capture anymore.
981 ERROR_PLAY_SRTP_ERROR = 200, // Generic receiver SRTP failure. 981 ERROR_PLAY_SRTP_ERROR = 200, // Generic receiver SRTP failure.
982 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. 982 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets.
983 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. 983 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected.
984 }; 984 };
985 985
986 VideoMediaChannel() {} 986 VideoMediaChannel(const MediaChannelOptions& options)
987 : MediaChannel(options) {}
987 virtual ~VideoMediaChannel() {} 988 virtual ~VideoMediaChannel() {}
988 989
989 virtual bool SetSendParameters(const VideoSendParameters& params) = 0; 990 virtual bool SetSendParameters(const VideoSendParameters& params) = 0;
990 virtual bool SetRecvParameters(const VideoRecvParameters& params) = 0; 991 virtual bool SetRecvParameters(const VideoRecvParameters& params) = 0;
991 // Gets the currently set codecs/payload types to be used for outgoing media. 992 // Gets the currently set codecs/payload types to be used for outgoing media.
992 virtual bool GetSendCodec(VideoCodec* send_codec) = 0; 993 virtual bool GetSendCodec(VideoCodec* send_codec) = 0;
993 // Starts or stops transmission (and potentially capture) of local video. 994 // Starts or stops transmission (and potentially capture) of local video.
994 virtual bool SetSend(bool send) = 0; 995 virtual bool SetSend(bool send) = 0;
995 // Configure stream for sending. 996 // Configure stream for sending.
996 virtual bool SetVideoSend(uint32_t ssrc, 997 virtual bool SetVideoSend(uint32_t ssrc,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 enum Error { 1100 enum Error {
1100 ERROR_NONE = 0, // No error. 1101 ERROR_NONE = 0, // No error.
1101 ERROR_OTHER, // Other errors. 1102 ERROR_OTHER, // Other errors.
1102 ERROR_SEND_SRTP_ERROR = 200, // Generic SRTP failure. 1103 ERROR_SEND_SRTP_ERROR = 200, // Generic SRTP failure.
1103 ERROR_SEND_SRTP_AUTH_FAILED, // Failed to authenticate packets. 1104 ERROR_SEND_SRTP_AUTH_FAILED, // Failed to authenticate packets.
1104 ERROR_RECV_SRTP_ERROR, // Generic SRTP failure. 1105 ERROR_RECV_SRTP_ERROR, // Generic SRTP failure.
1105 ERROR_RECV_SRTP_AUTH_FAILED, // Failed to authenticate packets. 1106 ERROR_RECV_SRTP_AUTH_FAILED, // Failed to authenticate packets.
1106 ERROR_RECV_SRTP_REPLAY, // Packet replay detected. 1107 ERROR_RECV_SRTP_REPLAY, // Packet replay detected.
1107 }; 1108 };
1108 1109
1110 DataMediaChannel(const MediaChannelOptions& options)
1111 : MediaChannel(options) {}
1109 virtual ~DataMediaChannel() {} 1112 virtual ~DataMediaChannel() {}
1110 1113
1111 virtual bool SetSendParameters(const DataSendParameters& params) = 0; 1114 virtual bool SetSendParameters(const DataSendParameters& params) = 0;
1112 virtual bool SetRecvParameters(const DataRecvParameters& params) = 0; 1115 virtual bool SetRecvParameters(const DataRecvParameters& params) = 0;
1113 1116
1114 // TODO(pthatcher): Implement this. 1117 // TODO(pthatcher): Implement this.
1115 virtual bool GetStats(DataMediaInfo* info) { return true; } 1118 virtual bool GetStats(DataMediaInfo* info) { return true; }
1116 1119
1117 virtual bool SetSend(bool send) = 0; 1120 virtual bool SetSend(bool send) = 0;
1118 virtual bool SetReceive(bool receive) = 0; 1121 virtual bool SetReceive(bool receive) = 0;
1119 1122
1120 virtual bool SendData( 1123 virtual bool SendData(
1121 const SendDataParams& params, 1124 const SendDataParams& params,
1122 const rtc::Buffer& payload, 1125 const rtc::Buffer& payload,
1123 SendDataResult* result = NULL) = 0; 1126 SendDataResult* result = NULL) = 0;
1124 // Signals when data is received (params, data, len) 1127 // Signals when data is received (params, data, len)
1125 sigslot::signal3<const ReceiveDataParams&, 1128 sigslot::signal3<const ReceiveDataParams&,
1126 const char*, 1129 const char*,
1127 size_t> SignalDataReceived; 1130 size_t> SignalDataReceived;
1128 // Signal when the media channel is ready to send the stream. Arguments are: 1131 // Signal when the media channel is ready to send the stream. Arguments are:
1129 // writable(bool) 1132 // writable(bool)
1130 sigslot::signal1<bool> SignalReadyToSend; 1133 sigslot::signal1<bool> SignalReadyToSend;
1131 // Signal for notifying that the remote side has closed the DataChannel. 1134 // Signal for notifying that the remote side has closed the DataChannel.
1132 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; 1135 sigslot::signal1<uint32_t> SignalStreamClosedRemotely;
1133 }; 1136 };
1134 1137
1135 } // namespace cricket 1138 } // namespace cricket
1136 1139
1137 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ 1140 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_
OLDNEW
« no previous file with comments | « webrtc/media/base/fakemediaengine.h ('k') | webrtc/media/base/mediaengine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698