Chromium Code Reviews| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 for (size_t i = 0; i < vals.size(); ++i) { | 87 for (size_t i = 0; i < vals.size(); ++i) { |
| 88 if (i > 0) { | 88 if (i > 0) { |
| 89 ost << ", "; | 89 ost << ", "; |
| 90 } | 90 } |
| 91 ost << vals[i].ToString(); | 91 ost << vals[i].ToString(); |
| 92 } | 92 } |
| 93 ost << "]"; | 93 ost << "]"; |
| 94 return ost.str(); | 94 return ost.str(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 struct MediaChannelOptions { | |
| 98 // Set DSCP value for packet sent from media channel. This flag | |
| 99 // comes from the PeerConnection constraint 'googDscp'. | |
| 100 bool enable_dscp = false; | |
|
pbos-webrtc
2016/02/01 10:57:54
To me it sounds like DSCP_DEFAULT is also some for
nisse-webrtc
2016/02/01 11:26:34
We're talking about is the diffserv bits in the IP
| |
| 101 }; | |
| 102 | |
| 97 // Options that can be applied to a VoiceMediaChannel or a VoiceMediaEngine. | 103 // Options that can be applied to a VoiceMediaChannel or a VoiceMediaEngine. |
| 98 // Used to be flags, but that makes it hard to selectively apply options. | 104 // Used to be flags, but that makes it hard to selectively apply options. |
| 99 // We are moving all of the setting of options to structs like this, | 105 // We are moving all of the setting of options to structs like this, |
| 100 // but some things currently still use flags. | 106 // but some things currently still use flags. |
| 101 struct AudioOptions { | 107 struct AudioOptions { |
| 102 void SetAll(const AudioOptions& change) { | 108 void SetAll(const AudioOptions& change) { |
| 103 SetFrom(&echo_cancellation, change.echo_cancellation); | 109 SetFrom(&echo_cancellation, change.echo_cancellation); |
| 104 SetFrom(&auto_gain_control, change.auto_gain_control); | 110 SetFrom(&auto_gain_control, change.auto_gain_control); |
| 105 SetFrom(&noise_suppression, change.noise_suppression); | 111 SetFrom(&noise_suppression, change.noise_suppression); |
| 106 SetFrom(&highpass_filter, change.highpass_filter); | 112 SetFrom(&highpass_filter, change.highpass_filter); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 117 SetFrom(&extended_filter_aec, change.extended_filter_aec); | 123 SetFrom(&extended_filter_aec, change.extended_filter_aec); |
| 118 SetFrom(&delay_agnostic_aec, change.delay_agnostic_aec); | 124 SetFrom(&delay_agnostic_aec, change.delay_agnostic_aec); |
| 119 SetFrom(&experimental_ns, change.experimental_ns); | 125 SetFrom(&experimental_ns, change.experimental_ns); |
| 120 SetFrom(&aec_dump, change.aec_dump); | 126 SetFrom(&aec_dump, change.aec_dump); |
| 121 SetFrom(&tx_agc_target_dbov, change.tx_agc_target_dbov); | 127 SetFrom(&tx_agc_target_dbov, change.tx_agc_target_dbov); |
| 122 SetFrom(&tx_agc_digital_compression_gain, | 128 SetFrom(&tx_agc_digital_compression_gain, |
| 123 change.tx_agc_digital_compression_gain); | 129 change.tx_agc_digital_compression_gain); |
| 124 SetFrom(&tx_agc_limiter, change.tx_agc_limiter); | 130 SetFrom(&tx_agc_limiter, change.tx_agc_limiter); |
| 125 SetFrom(&recording_sample_rate, change.recording_sample_rate); | 131 SetFrom(&recording_sample_rate, change.recording_sample_rate); |
| 126 SetFrom(&playout_sample_rate, change.playout_sample_rate); | 132 SetFrom(&playout_sample_rate, change.playout_sample_rate); |
| 127 SetFrom(&dscp, change.dscp); | |
| 128 SetFrom(&combined_audio_video_bwe, change.combined_audio_video_bwe); | 133 SetFrom(&combined_audio_video_bwe, change.combined_audio_video_bwe); |
| 129 } | 134 } |
| 130 | 135 |
| 131 bool operator==(const AudioOptions& o) const { | 136 bool operator==(const AudioOptions& o) const { |
| 132 return echo_cancellation == o.echo_cancellation && | 137 return echo_cancellation == o.echo_cancellation && |
| 133 auto_gain_control == o.auto_gain_control && | 138 auto_gain_control == o.auto_gain_control && |
| 134 noise_suppression == o.noise_suppression && | 139 noise_suppression == o.noise_suppression && |
| 135 highpass_filter == o.highpass_filter && | 140 highpass_filter == o.highpass_filter && |
| 136 stereo_swapping == o.stereo_swapping && | 141 stereo_swapping == o.stereo_swapping && |
| 137 audio_jitter_buffer_max_packets == o.audio_jitter_buffer_max_packets && | 142 audio_jitter_buffer_max_packets == o.audio_jitter_buffer_max_packets && |
| 138 audio_jitter_buffer_fast_accelerate == | 143 audio_jitter_buffer_fast_accelerate == |
| 139 o.audio_jitter_buffer_fast_accelerate && | 144 o.audio_jitter_buffer_fast_accelerate && |
| 140 typing_detection == o.typing_detection && | 145 typing_detection == o.typing_detection && |
| 141 aecm_generate_comfort_noise == o.aecm_generate_comfort_noise && | 146 aecm_generate_comfort_noise == o.aecm_generate_comfort_noise && |
| 142 conference_mode == o.conference_mode && | 147 conference_mode == o.conference_mode && |
| 143 experimental_agc == o.experimental_agc && | 148 experimental_agc == o.experimental_agc && |
| 144 extended_filter_aec == o.extended_filter_aec && | 149 extended_filter_aec == o.extended_filter_aec && |
| 145 delay_agnostic_aec == o.delay_agnostic_aec && | 150 delay_agnostic_aec == o.delay_agnostic_aec && |
| 146 experimental_ns == o.experimental_ns && | 151 experimental_ns == o.experimental_ns && |
| 147 adjust_agc_delta == o.adjust_agc_delta && | 152 adjust_agc_delta == o.adjust_agc_delta && |
| 148 aec_dump == o.aec_dump && | 153 aec_dump == o.aec_dump && |
| 149 tx_agc_target_dbov == o.tx_agc_target_dbov && | 154 tx_agc_target_dbov == o.tx_agc_target_dbov && |
| 150 tx_agc_digital_compression_gain == o.tx_agc_digital_compression_gain && | 155 tx_agc_digital_compression_gain == o.tx_agc_digital_compression_gain && |
| 151 tx_agc_limiter == o.tx_agc_limiter && | 156 tx_agc_limiter == o.tx_agc_limiter && |
| 152 recording_sample_rate == o.recording_sample_rate && | 157 recording_sample_rate == o.recording_sample_rate && |
| 153 playout_sample_rate == o.playout_sample_rate && | 158 playout_sample_rate == o.playout_sample_rate && |
| 154 dscp == o.dscp && | |
| 155 combined_audio_video_bwe == o.combined_audio_video_bwe; | 159 combined_audio_video_bwe == o.combined_audio_video_bwe; |
| 156 } | 160 } |
| 157 | 161 |
| 158 std::string ToString() const { | 162 std::string ToString() const { |
| 159 std::ostringstream ost; | 163 std::ostringstream ost; |
| 160 ost << "AudioOptions {"; | 164 ost << "AudioOptions {"; |
| 161 ost << ToStringIfSet("aec", echo_cancellation); | 165 ost << ToStringIfSet("aec", echo_cancellation); |
| 162 ost << ToStringIfSet("agc", auto_gain_control); | 166 ost << ToStringIfSet("agc", auto_gain_control); |
| 163 ost << ToStringIfSet("ns", noise_suppression); | 167 ost << ToStringIfSet("ns", noise_suppression); |
| 164 ost << ToStringIfSet("hf", highpass_filter); | 168 ost << ToStringIfSet("hf", highpass_filter); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 175 ost << ToStringIfSet("extended_filter_aec", extended_filter_aec); | 179 ost << ToStringIfSet("extended_filter_aec", extended_filter_aec); |
| 176 ost << ToStringIfSet("delay_agnostic_aec", delay_agnostic_aec); | 180 ost << ToStringIfSet("delay_agnostic_aec", delay_agnostic_aec); |
| 177 ost << ToStringIfSet("experimental_ns", experimental_ns); | 181 ost << ToStringIfSet("experimental_ns", experimental_ns); |
| 178 ost << ToStringIfSet("aec_dump", aec_dump); | 182 ost << ToStringIfSet("aec_dump", aec_dump); |
| 179 ost << ToStringIfSet("tx_agc_target_dbov", tx_agc_target_dbov); | 183 ost << ToStringIfSet("tx_agc_target_dbov", tx_agc_target_dbov); |
| 180 ost << ToStringIfSet("tx_agc_digital_compression_gain", | 184 ost << ToStringIfSet("tx_agc_digital_compression_gain", |
| 181 tx_agc_digital_compression_gain); | 185 tx_agc_digital_compression_gain); |
| 182 ost << ToStringIfSet("tx_agc_limiter", tx_agc_limiter); | 186 ost << ToStringIfSet("tx_agc_limiter", tx_agc_limiter); |
| 183 ost << ToStringIfSet("recording_sample_rate", recording_sample_rate); | 187 ost << ToStringIfSet("recording_sample_rate", recording_sample_rate); |
| 184 ost << ToStringIfSet("playout_sample_rate", playout_sample_rate); | 188 ost << ToStringIfSet("playout_sample_rate", playout_sample_rate); |
| 185 ost << ToStringIfSet("dscp", dscp); | |
| 186 ost << ToStringIfSet("combined_audio_video_bwe", combined_audio_video_bwe); | 189 ost << ToStringIfSet("combined_audio_video_bwe", combined_audio_video_bwe); |
| 187 ost << "}"; | 190 ost << "}"; |
| 188 return ost.str(); | 191 return ost.str(); |
| 189 } | 192 } |
| 190 | 193 |
| 191 // Audio processing that attempts to filter away the output signal from | 194 // Audio processing that attempts to filter away the output signal from |
| 192 // later inbound pickup. | 195 // later inbound pickup. |
| 193 rtc::Optional<bool> echo_cancellation; | 196 rtc::Optional<bool> echo_cancellation; |
| 194 // Audio processing to adjust the sensitivity of the local mic dynamically. | 197 // Audio processing to adjust the sensitivity of the local mic dynamically. |
| 195 rtc::Optional<bool> auto_gain_control; | 198 rtc::Optional<bool> auto_gain_control; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 212 rtc::Optional<bool> extended_filter_aec; | 215 rtc::Optional<bool> extended_filter_aec; |
| 213 rtc::Optional<bool> delay_agnostic_aec; | 216 rtc::Optional<bool> delay_agnostic_aec; |
| 214 rtc::Optional<bool> experimental_ns; | 217 rtc::Optional<bool> experimental_ns; |
| 215 rtc::Optional<bool> aec_dump; | 218 rtc::Optional<bool> aec_dump; |
| 216 // Note that tx_agc_* only applies to non-experimental AGC. | 219 // Note that tx_agc_* only applies to non-experimental AGC. |
| 217 rtc::Optional<uint16_t> tx_agc_target_dbov; | 220 rtc::Optional<uint16_t> tx_agc_target_dbov; |
| 218 rtc::Optional<uint16_t> tx_agc_digital_compression_gain; | 221 rtc::Optional<uint16_t> tx_agc_digital_compression_gain; |
| 219 rtc::Optional<bool> tx_agc_limiter; | 222 rtc::Optional<bool> tx_agc_limiter; |
| 220 rtc::Optional<uint32_t> recording_sample_rate; | 223 rtc::Optional<uint32_t> recording_sample_rate; |
| 221 rtc::Optional<uint32_t> playout_sample_rate; | 224 rtc::Optional<uint32_t> playout_sample_rate; |
| 222 // Set DSCP value for packet sent from audio channel. | |
| 223 rtc::Optional<bool> dscp; | |
| 224 // Enable combined audio+bandwidth BWE. | 225 // Enable combined audio+bandwidth BWE. |
| 225 rtc::Optional<bool> combined_audio_video_bwe; | 226 rtc::Optional<bool> combined_audio_video_bwe; |
| 226 | 227 |
| 227 private: | 228 private: |
| 228 template <typename T> | 229 template <typename T> |
| 229 static void SetFrom(rtc::Optional<T>* s, const rtc::Optional<T>& o) { | 230 static void SetFrom(rtc::Optional<T>* s, const rtc::Optional<T>& o) { |
| 230 if (o) { | 231 if (o) { |
| 231 *s = o; | 232 *s = o; |
| 232 } | 233 } |
| 233 } | 234 } |
| 234 }; | 235 }; |
| 235 | 236 |
| 236 // Options that can be applied to a VideoMediaChannel or a VideoMediaEngine. | 237 // Options that can be applied to a VideoMediaChannel or a VideoMediaEngine. |
| 237 // Used to be flags, but that makes it hard to selectively apply options. | 238 // Used to be flags, but that makes it hard to selectively apply options. |
| 238 // We are moving all of the setting of options to structs like this, | 239 // We are moving all of the setting of options to structs like this, |
| 239 // but some things currently still use flags. | 240 // but some things currently still use flags. |
| 240 struct VideoOptions { | 241 struct VideoOptions { |
| 241 void SetAll(const VideoOptions& change) { | 242 void SetAll(const VideoOptions& change) { |
| 242 SetFrom(&video_noise_reduction, change.video_noise_reduction); | 243 SetFrom(&video_noise_reduction, change.video_noise_reduction); |
| 243 SetFrom(&cpu_overuse_detection, change.cpu_overuse_detection); | 244 SetFrom(&cpu_overuse_detection, change.cpu_overuse_detection); |
| 244 SetFrom(&conference_mode, change.conference_mode); | 245 SetFrom(&conference_mode, change.conference_mode); |
| 245 SetFrom(&dscp, change.dscp); | |
| 246 SetFrom(&suspend_below_min_bitrate, change.suspend_below_min_bitrate); | 246 SetFrom(&suspend_below_min_bitrate, change.suspend_below_min_bitrate); |
| 247 SetFrom(&screencast_min_bitrate_kbps, change.screencast_min_bitrate_kbps); | 247 SetFrom(&screencast_min_bitrate_kbps, change.screencast_min_bitrate_kbps); |
| 248 SetFrom(&disable_prerenderer_smoothing, | 248 SetFrom(&disable_prerenderer_smoothing, |
| 249 change.disable_prerenderer_smoothing); | 249 change.disable_prerenderer_smoothing); |
| 250 } | 250 } |
| 251 | 251 |
| 252 bool operator==(const VideoOptions& o) const { | 252 bool operator==(const VideoOptions& o) const { |
| 253 return video_noise_reduction == o.video_noise_reduction && | 253 return video_noise_reduction == o.video_noise_reduction && |
| 254 cpu_overuse_detection == o.cpu_overuse_detection && | 254 cpu_overuse_detection == o.cpu_overuse_detection && |
| 255 conference_mode == o.conference_mode && | 255 conference_mode == o.conference_mode && |
| 256 dscp == o.dscp && | |
| 257 suspend_below_min_bitrate == o.suspend_below_min_bitrate && | 256 suspend_below_min_bitrate == o.suspend_below_min_bitrate && |
| 258 screencast_min_bitrate_kbps == o.screencast_min_bitrate_kbps && | 257 screencast_min_bitrate_kbps == o.screencast_min_bitrate_kbps && |
| 259 disable_prerenderer_smoothing == o.disable_prerenderer_smoothing; | 258 disable_prerenderer_smoothing == o.disable_prerenderer_smoothing; |
| 260 } | 259 } |
| 261 | 260 |
| 262 std::string ToString() const { | 261 std::string ToString() const { |
| 263 std::ostringstream ost; | 262 std::ostringstream ost; |
| 264 ost << "VideoOptions {"; | 263 ost << "VideoOptions {"; |
| 265 ost << ToStringIfSet("noise reduction", video_noise_reduction); | 264 ost << ToStringIfSet("noise reduction", video_noise_reduction); |
| 266 ost << ToStringIfSet("cpu overuse detection", cpu_overuse_detection); | 265 ost << ToStringIfSet("cpu overuse detection", cpu_overuse_detection); |
| 267 ost << ToStringIfSet("conference mode", conference_mode); | 266 ost << ToStringIfSet("conference mode", conference_mode); |
| 268 ost << ToStringIfSet("dscp", dscp); | |
| 269 ost << ToStringIfSet("suspend below min bitrate", | 267 ost << ToStringIfSet("suspend below min bitrate", |
| 270 suspend_below_min_bitrate); | 268 suspend_below_min_bitrate); |
| 271 ost << ToStringIfSet("screencast min bitrate kbps", | 269 ost << ToStringIfSet("screencast min bitrate kbps", |
| 272 screencast_min_bitrate_kbps); | 270 screencast_min_bitrate_kbps); |
| 273 ost << "}"; | 271 ost << "}"; |
| 274 return ost.str(); | 272 return ost.str(); |
| 275 } | 273 } |
| 276 | 274 |
| 277 // Enable denoising? This flag comes from the getUserMedia | 275 // Enable denoising? This flag comes from the getUserMedia |
| 278 // constraint 'googNoiseReduction', and WebRtcVideoEngine2 passes it | 276 // constraint 'googNoiseReduction', and WebRtcVideoEngine2 passes it |
| 279 // on to the codec options. Disabled by default. | 277 // on to the codec options. Disabled by default. |
| 280 rtc::Optional<bool> video_noise_reduction; | 278 rtc::Optional<bool> video_noise_reduction; |
| 281 // Enable WebRTC Cpu Overuse Detection. This flag comes from the | 279 // Enable WebRTC Cpu Overuse Detection. This flag comes from the |
| 282 // PeerConnection constraint 'googCpuOveruseDetection' and is | 280 // PeerConnection constraint 'googCpuOveruseDetection' and is |
| 283 // checked in WebRtcVideoChannel2::OnLoadUpdate, where it's passed | 281 // checked in WebRtcVideoChannel2::OnLoadUpdate, where it's passed |
| 284 // to VideoCapturer::video_adapter()->OnCpuResolutionRequest. | 282 // to VideoCapturer::video_adapter()->OnCpuResolutionRequest. |
| 285 rtc::Optional<bool> cpu_overuse_detection; | 283 rtc::Optional<bool> cpu_overuse_detection; |
| 286 // Use conference mode? This flag comes from the remote | 284 // Use conference mode? This flag comes from the remote |
| 287 // description's SDP line 'a=x-google-flag:conference', copied over | 285 // description's SDP line 'a=x-google-flag:conference', copied over |
| 288 // by VideoChannel::SetRemoteContent_w, and ultimately used by | 286 // by VideoChannel::SetRemoteContent_w, and ultimately used by |
| 289 // conference mode screencast logic in | 287 // conference mode screencast logic in |
| 290 // WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoderConfig. | 288 // WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoderConfig. |
| 291 // The special screencast behaviour is disabled by default. | 289 // The special screencast behaviour is disabled by default. |
| 292 rtc::Optional<bool> conference_mode; | 290 rtc::Optional<bool> conference_mode; |
| 293 // Set DSCP value for packet sent from video channel. This flag | |
| 294 // comes from the PeerConnection constraint 'googDscp' and, | |
| 295 // WebRtcVideoChannel2::SetOptions checks it before calling | |
| 296 // MediaChannel::SetDscp. If enabled, rtc::DSCP_AF41 is used. If | |
| 297 // disabled, which is the default, rtc::DSCP_DEFAULT is used. | |
| 298 rtc::Optional<bool> dscp; | |
| 299 // Enable WebRTC suspension of video. No video frames will be sent | 291 // Enable WebRTC suspension of video. No video frames will be sent |
| 300 // when the bitrate is below the configured minimum bitrate. This | 292 // when the bitrate is below the configured minimum bitrate. This |
| 301 // flag comes from the PeerConnection constraint | 293 // flag comes from the PeerConnection constraint |
| 302 // 'googSuspendBelowMinBitrate', and WebRtcVideoChannel2 copies it | 294 // 'googSuspendBelowMinBitrate', and WebRtcVideoChannel2 copies it |
| 303 // to VideoSendStream::Config::suspend_below_min_bitrate. | 295 // to VideoSendStream::Config::suspend_below_min_bitrate. |
| 304 rtc::Optional<bool> suspend_below_min_bitrate; | 296 rtc::Optional<bool> suspend_below_min_bitrate; |
| 305 // Force screencast to use a minimum bitrate. This flag comes from | 297 // Force screencast to use a minimum bitrate. This flag comes from |
| 306 // the PeerConnection constraint 'googScreencastMinBitrate'. It is | 298 // the PeerConnection constraint 'googScreencastMinBitrate'. It is |
| 307 // copied to the encoder config by WebRtcVideoChannel2. | 299 // copied to the encoder config by WebRtcVideoChannel2. |
| 308 rtc::Optional<int> screencast_min_bitrate_kbps; | 300 rtc::Optional<int> screencast_min_bitrate_kbps; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 377 enum SocketType { ST_RTP, ST_RTCP }; | 369 enum SocketType { ST_RTP, ST_RTCP }; |
| 378 virtual bool SendPacket(rtc::Buffer* packet, | 370 virtual bool SendPacket(rtc::Buffer* packet, |
| 379 const rtc::PacketOptions& options) = 0; | 371 const rtc::PacketOptions& options) = 0; |
| 380 virtual bool SendRtcp(rtc::Buffer* packet, | 372 virtual bool SendRtcp(rtc::Buffer* packet, |
| 381 const rtc::PacketOptions& options) = 0; | 373 const rtc::PacketOptions& options) = 0; |
| 382 virtual int SetOption(SocketType type, rtc::Socket::Option opt, | 374 virtual int SetOption(SocketType type, rtc::Socket::Option opt, |
| 383 int option) = 0; | 375 int option) = 0; |
| 384 virtual ~NetworkInterface() {} | 376 virtual ~NetworkInterface() {} |
| 385 }; | 377 }; |
| 386 | 378 |
| 387 MediaChannel() : network_interface_(NULL) {} | 379 MediaChannel(const MediaChannelOptions& options) |
| 380 : options_(options), network_interface_(NULL) {} | |
| 381 MediaChannel() : options_(), network_interface_(NULL) {} | |
| 388 virtual ~MediaChannel() {} | 382 virtual ~MediaChannel() {} |
| 389 | 383 |
| 390 // Sets the abstract interface class for sending RTP/RTCP data. | 384 // Sets the abstract interface class for sending RTP/RTCP data. |
| 391 virtual void SetInterface(NetworkInterface *iface) { | 385 virtual void SetInterface(NetworkInterface *iface) { |
| 392 rtc::CritScope cs(&network_interface_crit_); | 386 rtc::CritScope cs(&network_interface_crit_); |
| 393 network_interface_ = iface; | 387 network_interface_ = iface; |
| 388 SetDscp(options_.enable_dscp ? DscpValue() : rtc::DSCP_DEFAULT); | |
| 394 } | 389 } |
| 395 | 390 virtual rtc::DiffServCodePoint DscpValue() const { return rtc::DSCP_DEFAULT; } |
|
pbos-webrtc
2016/02/01 10:57:54
This method name confuses me, should this be DscpV
nisse-webrtc
2016/02/01 11:26:34
The intention is to return the diffserve codepoint
pbos-webrtc
2016/02/01 11:27:21
Name this MediaTypeDscpValue() then perhaps?
nisse-webrtc
2016/02/01 12:09:45
Done.
| |
| 396 // Called when a RTP packet is received. | 391 // Called when a RTP packet is received. |
| 397 virtual void OnPacketReceived(rtc::Buffer* packet, | 392 virtual void OnPacketReceived(rtc::Buffer* packet, |
| 398 const rtc::PacketTime& packet_time) = 0; | 393 const rtc::PacketTime& packet_time) = 0; |
| 399 // Called when a RTCP packet is received. | 394 // Called when a RTCP packet is received. |
| 400 virtual void OnRtcpReceived(rtc::Buffer* packet, | 395 virtual void OnRtcpReceived(rtc::Buffer* packet, |
| 401 const rtc::PacketTime& packet_time) = 0; | 396 const rtc::PacketTime& packet_time) = 0; |
| 402 // Called when the socket's ability to send has changed. | 397 // Called when the socket's ability to send has changed. |
| 403 virtual void OnReadyToSend(bool ready) = 0; | 398 virtual void OnReadyToSend(bool ready) = 0; |
| 404 // Creates a new outgoing media stream with SSRCs and CNAME as described | 399 // Creates a new outgoing media stream with SSRCs and CNAME as described |
| 405 // by sp. | 400 // by sp. |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 433 int SetOption(NetworkInterface::SocketType type, | 428 int SetOption(NetworkInterface::SocketType type, |
| 434 rtc::Socket::Option opt, | 429 rtc::Socket::Option opt, |
| 435 int option) { | 430 int option) { |
| 436 rtc::CritScope cs(&network_interface_crit_); | 431 rtc::CritScope cs(&network_interface_crit_); |
| 437 if (!network_interface_) | 432 if (!network_interface_) |
| 438 return -1; | 433 return -1; |
| 439 | 434 |
| 440 return network_interface_->SetOption(type, opt, option); | 435 return network_interface_->SetOption(type, opt, option); |
| 441 } | 436 } |
| 442 | 437 |
| 443 protected: | 438 private: |
| 444 // This method sets DSCP |value| on both RTP and RTCP channels. | 439 // This method sets DSCP |value| on both RTP and RTCP channels. |
| 445 int SetDscp(rtc::DiffServCodePoint value) { | 440 int SetDscp(rtc::DiffServCodePoint value) { |
| 446 int ret; | 441 int ret; |
| 447 ret = SetOption(NetworkInterface::ST_RTP, | 442 ret = SetOption(NetworkInterface::ST_RTP, |
| 448 rtc::Socket::OPT_DSCP, | 443 rtc::Socket::OPT_DSCP, |
| 449 value); | 444 value); |
| 450 if (ret == 0) { | 445 if (ret == 0) { |
| 451 ret = SetOption(NetworkInterface::ST_RTCP, | 446 ret = SetOption(NetworkInterface::ST_RTCP, |
| 452 rtc::Socket::OPT_DSCP, | 447 rtc::Socket::OPT_DSCP, |
| 453 value); | 448 value); |
| 454 } | 449 } |
| 455 return ret; | 450 return ret; |
| 456 } | 451 } |
| 457 | 452 |
| 458 private: | |
| 459 bool DoSendPacket(rtc::Buffer* packet, | 453 bool DoSendPacket(rtc::Buffer* packet, |
| 460 bool rtcp, | 454 bool rtcp, |
| 461 const rtc::PacketOptions& options) { | 455 const rtc::PacketOptions& options) { |
| 462 rtc::CritScope cs(&network_interface_crit_); | 456 rtc::CritScope cs(&network_interface_crit_); |
| 463 if (!network_interface_) | 457 if (!network_interface_) |
| 464 return false; | 458 return false; |
| 465 | 459 |
| 466 return (!rtcp) ? network_interface_->SendPacket(packet, options) | 460 return (!rtcp) ? network_interface_->SendPacket(packet, options) |
| 467 : network_interface_->SendRtcp(packet, options); | 461 : network_interface_->SendRtcp(packet, options); |
| 468 } | 462 } |
| 469 | 463 |
| 464 const MediaChannelOptions options_; | |
| 470 // |network_interface_| can be accessed from the worker_thread and | 465 // |network_interface_| can be accessed from the worker_thread and |
| 471 // from any MediaEngine threads. This critical section is to protect accessing | 466 // from any MediaEngine threads. This critical section is to protect accessing |
| 472 // of network_interface_ object. | 467 // of network_interface_ object. |
| 473 rtc::CriticalSection network_interface_crit_; | 468 rtc::CriticalSection network_interface_crit_; |
| 474 NetworkInterface* network_interface_; | 469 NetworkInterface* network_interface_; |
| 475 }; | 470 }; |
| 476 | 471 |
| 477 enum SendFlags { | 472 enum SendFlags { |
| 478 SEND_NOTHING, | 473 SEND_NOTHING, |
| 479 SEND_MICROPHONE | 474 SEND_MICROPHONE |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 912 ERROR_REC_TYPING_NOISE_DETECTED, // Typing noise is detected. | 907 ERROR_REC_TYPING_NOISE_DETECTED, // Typing noise is detected. |
| 913 ERROR_PLAY_DEVICE_OPEN_FAILED = 200, // Could not open playout. | 908 ERROR_PLAY_DEVICE_OPEN_FAILED = 200, // Could not open playout. |
| 914 ERROR_PLAY_DEVICE_MUTED, // Playout muted by OS. | 909 ERROR_PLAY_DEVICE_MUTED, // Playout muted by OS. |
| 915 ERROR_PLAY_DEVICE_REMOVED, // Playout removed while active. | 910 ERROR_PLAY_DEVICE_REMOVED, // Playout removed while active. |
| 916 ERROR_PLAY_RUNTIME_ERROR, // Errors in voice processing. | 911 ERROR_PLAY_RUNTIME_ERROR, // Errors in voice processing. |
| 917 ERROR_PLAY_SRTP_ERROR, // Generic SRTP failure. | 912 ERROR_PLAY_SRTP_ERROR, // Generic SRTP failure. |
| 918 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 913 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
| 919 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. | 914 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. |
| 920 }; | 915 }; |
| 921 | 916 |
| 917 VoiceMediaChannel(const MediaChannelOptions& options) | |
| 918 : MediaChannel(options) {} | |
| 922 VoiceMediaChannel() {} | 919 VoiceMediaChannel() {} |
| 920 | |
| 923 virtual ~VoiceMediaChannel() {} | 921 virtual ~VoiceMediaChannel() {} |
| 924 virtual bool SetSendParameters(const AudioSendParameters& params) = 0; | 922 virtual bool SetSendParameters(const AudioSendParameters& params) = 0; |
| 925 virtual bool SetRecvParameters(const AudioRecvParameters& params) = 0; | 923 virtual bool SetRecvParameters(const AudioRecvParameters& params) = 0; |
| 926 // Starts or stops playout of received audio. | 924 // Starts or stops playout of received audio. |
| 927 virtual bool SetPlayout(bool playout) = 0; | 925 virtual bool SetPlayout(bool playout) = 0; |
| 928 // Starts or stops sending (and potentially capture) of local audio. | 926 // Starts or stops sending (and potentially capture) of local audio. |
| 929 virtual bool SetSend(SendFlags flag) = 0; | 927 virtual bool SetSend(SendFlags flag) = 0; |
| 930 // Configure stream for sending. | 928 // Configure stream for sending. |
| 931 virtual bool SetAudioSend(uint32_t ssrc, | 929 virtual bool SetAudioSend(uint32_t ssrc, |
| 932 bool enable, | 930 bool enable, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 975 ERROR_REC_DEVICE_IN_USE, // Device is in already use. | 973 ERROR_REC_DEVICE_IN_USE, // Device is in already use. |
| 976 ERROR_REC_DEVICE_REMOVED, // Device is removed. | 974 ERROR_REC_DEVICE_REMOVED, // Device is removed. |
| 977 ERROR_REC_SRTP_ERROR, // Generic sender SRTP failure. | 975 ERROR_REC_SRTP_ERROR, // Generic sender SRTP failure. |
| 978 ERROR_REC_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 976 ERROR_REC_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
| 979 ERROR_REC_CPU_MAX_CANT_DOWNGRADE, // Can't downgrade capture anymore. | 977 ERROR_REC_CPU_MAX_CANT_DOWNGRADE, // Can't downgrade capture anymore. |
| 980 ERROR_PLAY_SRTP_ERROR = 200, // Generic receiver SRTP failure. | 978 ERROR_PLAY_SRTP_ERROR = 200, // Generic receiver SRTP failure. |
| 981 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 979 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
| 982 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. | 980 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. |
| 983 }; | 981 }; |
| 984 | 982 |
| 985 VideoMediaChannel() : renderer_(NULL) {} | 983 VideoMediaChannel(const MediaChannelOptions& options) |
| 984 : MediaChannel(options), renderer_(NULL) {} | |
| 985 VideoMediaChannel() : MediaChannel(), renderer_(NULL) {} | |
| 986 virtual ~VideoMediaChannel() {} | 986 virtual ~VideoMediaChannel() {} |
| 987 | 987 |
| 988 virtual bool SetSendParameters(const VideoSendParameters& params) = 0; | 988 virtual bool SetSendParameters(const VideoSendParameters& params) = 0; |
| 989 virtual bool SetRecvParameters(const VideoRecvParameters& params) = 0; | 989 virtual bool SetRecvParameters(const VideoRecvParameters& params) = 0; |
| 990 // Gets the currently set codecs/payload types to be used for outgoing media. | 990 // Gets the currently set codecs/payload types to be used for outgoing media. |
| 991 virtual bool GetSendCodec(VideoCodec* send_codec) = 0; | 991 virtual bool GetSendCodec(VideoCodec* send_codec) = 0; |
| 992 // Sets the format of a specified outgoing stream. | 992 // Sets the format of a specified outgoing stream. |
| 993 virtual bool SetSendStreamFormat(uint32_t ssrc, | 993 virtual bool SetSendStreamFormat(uint32_t ssrc, |
| 994 const VideoFormat& format) = 0; | 994 const VideoFormat& format) = 0; |
| 995 // Starts or stops transmission (and potentially capture) of local video. | 995 // Starts or stops transmission (and potentially capture) of local video. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1137 // Signal when the media channel is ready to send the stream. Arguments are: | 1137 // Signal when the media channel is ready to send the stream. Arguments are: |
| 1138 // writable(bool) | 1138 // writable(bool) |
| 1139 sigslot::signal1<bool> SignalReadyToSend; | 1139 sigslot::signal1<bool> SignalReadyToSend; |
| 1140 // Signal for notifying that the remote side has closed the DataChannel. | 1140 // Signal for notifying that the remote side has closed the DataChannel. |
| 1141 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; | 1141 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; |
| 1142 }; | 1142 }; |
| 1143 | 1143 |
| 1144 } // namespace cricket | 1144 } // namespace cricket |
| 1145 | 1145 |
| 1146 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ | 1146 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ |
| OLD | NEW |