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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 *s = o; | 231 *s = o; |
232 } | 232 } |
233 } | 233 } |
234 }; | 234 }; |
235 | 235 |
236 // Options that can be applied to a VideoMediaChannel or a VideoMediaEngine. | 236 // 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. | 237 // 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, | 238 // We are moving all of the setting of options to structs like this, |
239 // but some things currently still use flags. | 239 // but some things currently still use flags. |
240 struct VideoOptions { | 240 struct VideoOptions { |
241 VideoOptions() | |
242 : process_adaptation_threshhold(kProcessCpuThreshold), | |
243 system_low_adaptation_threshhold(kLowSystemCpuThreshold), | |
244 system_high_adaptation_threshhold(kHighSystemCpuThreshold), | |
245 unsignalled_recv_stream_limit(kNumDefaultUnsignalledVideoRecvStreams) {} | |
246 | |
247 void SetAll(const VideoOptions& change) { | 241 void SetAll(const VideoOptions& change) { |
248 SetFrom(&adapt_input_to_cpu_usage, change.adapt_input_to_cpu_usage); | |
249 SetFrom(&adapt_cpu_with_smoothing, change.adapt_cpu_with_smoothing); | |
250 SetFrom(&video_adapt_third, change.video_adapt_third); | |
251 SetFrom(&video_noise_reduction, change.video_noise_reduction); | 242 SetFrom(&video_noise_reduction, change.video_noise_reduction); |
252 SetFrom(&video_start_bitrate, change.video_start_bitrate); | |
253 SetFrom(&cpu_overuse_detection, change.cpu_overuse_detection); | 243 SetFrom(&cpu_overuse_detection, change.cpu_overuse_detection); |
254 SetFrom(&cpu_underuse_threshold, change.cpu_underuse_threshold); | |
255 SetFrom(&cpu_overuse_threshold, change.cpu_overuse_threshold); | |
256 SetFrom(&cpu_underuse_encode_rsd_threshold, | |
257 change.cpu_underuse_encode_rsd_threshold); | |
258 SetFrom(&cpu_overuse_encode_rsd_threshold, | |
259 change.cpu_overuse_encode_rsd_threshold); | |
260 SetFrom(&cpu_overuse_encode_usage, change.cpu_overuse_encode_usage); | |
261 SetFrom(&conference_mode, change.conference_mode); | 244 SetFrom(&conference_mode, change.conference_mode); |
262 SetFrom(&process_adaptation_threshhold, | |
263 change.process_adaptation_threshhold); | |
264 SetFrom(&system_low_adaptation_threshhold, | |
265 change.system_low_adaptation_threshhold); | |
266 SetFrom(&system_high_adaptation_threshhold, | |
267 change.system_high_adaptation_threshhold); | |
268 SetFrom(&dscp, change.dscp); | 245 SetFrom(&dscp, change.dscp); |
269 SetFrom(&suspend_below_min_bitrate, change.suspend_below_min_bitrate); | 246 SetFrom(&suspend_below_min_bitrate, change.suspend_below_min_bitrate); |
270 SetFrom(&unsignalled_recv_stream_limit, | |
271 change.unsignalled_recv_stream_limit); | |
272 SetFrom(&use_simulcast_adapter, change.use_simulcast_adapter); | |
273 SetFrom(&screencast_min_bitrate, change.screencast_min_bitrate); | 247 SetFrom(&screencast_min_bitrate, change.screencast_min_bitrate); |
274 SetFrom(&disable_prerenderer_smoothing, | 248 SetFrom(&disable_prerenderer_smoothing, |
275 change.disable_prerenderer_smoothing); | 249 change.disable_prerenderer_smoothing); |
276 } | 250 } |
277 | 251 |
278 bool operator==(const VideoOptions& o) const { | 252 bool operator==(const VideoOptions& o) const { |
279 return adapt_input_to_cpu_usage == o.adapt_input_to_cpu_usage && | 253 return video_noise_reduction == o.video_noise_reduction && |
280 adapt_cpu_with_smoothing == o.adapt_cpu_with_smoothing && | |
281 video_adapt_third == o.video_adapt_third && | |
282 video_noise_reduction == o.video_noise_reduction && | |
283 video_start_bitrate == o.video_start_bitrate && | |
284 cpu_overuse_detection == o.cpu_overuse_detection && | 254 cpu_overuse_detection == o.cpu_overuse_detection && |
285 cpu_underuse_threshold == o.cpu_underuse_threshold && | |
286 cpu_overuse_threshold == o.cpu_overuse_threshold && | |
287 cpu_underuse_encode_rsd_threshold == | |
288 o.cpu_underuse_encode_rsd_threshold && | |
289 cpu_overuse_encode_rsd_threshold == | |
290 o.cpu_overuse_encode_rsd_threshold && | |
291 cpu_overuse_encode_usage == o.cpu_overuse_encode_usage && | |
292 conference_mode == o.conference_mode && | 255 conference_mode == o.conference_mode && |
293 process_adaptation_threshhold == o.process_adaptation_threshhold && | |
294 system_low_adaptation_threshhold == | |
295 o.system_low_adaptation_threshhold && | |
296 system_high_adaptation_threshhold == | |
297 o.system_high_adaptation_threshhold && | |
298 dscp == o.dscp && | 256 dscp == o.dscp && |
299 suspend_below_min_bitrate == o.suspend_below_min_bitrate && | 257 suspend_below_min_bitrate == o.suspend_below_min_bitrate && |
300 unsignalled_recv_stream_limit == o.unsignalled_recv_stream_limit && | |
301 use_simulcast_adapter == o.use_simulcast_adapter && | |
302 screencast_min_bitrate == o.screencast_min_bitrate && | 258 screencast_min_bitrate == o.screencast_min_bitrate && |
303 disable_prerenderer_smoothing == o.disable_prerenderer_smoothing; | 259 disable_prerenderer_smoothing == o.disable_prerenderer_smoothing; |
304 } | 260 } |
305 | 261 |
306 std::string ToString() const { | 262 std::string ToString() const { |
307 std::ostringstream ost; | 263 std::ostringstream ost; |
308 ost << "VideoOptions {"; | 264 ost << "VideoOptions {"; |
309 ost << ToStringIfSet("cpu adaption", adapt_input_to_cpu_usage); | |
310 ost << ToStringIfSet("cpu adaptation smoothing", adapt_cpu_with_smoothing); | |
311 ost << ToStringIfSet("video adapt third", video_adapt_third); | |
312 ost << ToStringIfSet("noise reduction", video_noise_reduction); | 265 ost << ToStringIfSet("noise reduction", video_noise_reduction); |
313 ost << ToStringIfSet("start bitrate", video_start_bitrate); | |
314 ost << ToStringIfSet("cpu overuse detection", cpu_overuse_detection); | 266 ost << ToStringIfSet("cpu overuse detection", cpu_overuse_detection); |
315 ost << ToStringIfSet("cpu underuse threshold", cpu_underuse_threshold); | |
316 ost << ToStringIfSet("cpu overuse threshold", cpu_overuse_threshold); | |
317 ost << ToStringIfSet("cpu underuse encode rsd threshold", | |
318 cpu_underuse_encode_rsd_threshold); | |
319 ost << ToStringIfSet("cpu overuse encode rsd threshold", | |
320 cpu_overuse_encode_rsd_threshold); | |
321 ost << ToStringIfSet("cpu overuse encode usage", | |
322 cpu_overuse_encode_usage); | |
323 ost << ToStringIfSet("conference mode", conference_mode); | 267 ost << ToStringIfSet("conference mode", conference_mode); |
324 ost << ToStringIfSet("process", process_adaptation_threshhold); | |
325 ost << ToStringIfSet("low", system_low_adaptation_threshhold); | |
326 ost << ToStringIfSet("high", system_high_adaptation_threshhold); | |
327 ost << ToStringIfSet("dscp", dscp); | 268 ost << ToStringIfSet("dscp", dscp); |
328 ost << ToStringIfSet("suspend below min bitrate", | 269 ost << ToStringIfSet("suspend below min bitrate", |
329 suspend_below_min_bitrate); | 270 suspend_below_min_bitrate); |
330 ost << ToStringIfSet("num channels for early receive", | |
331 unsignalled_recv_stream_limit); | |
332 ost << ToStringIfSet("use simulcast adapter", use_simulcast_adapter); | |
333 ost << ToStringIfSet("screencast min bitrate", screencast_min_bitrate); | 271 ost << ToStringIfSet("screencast min bitrate", screencast_min_bitrate); |
334 ost << "}"; | 272 ost << "}"; |
335 return ost.str(); | 273 return ost.str(); |
336 } | 274 } |
337 | 275 |
338 // Enable CPU adaptation? | 276 // Enable denoising? VideoSource sets this from the |
339 rtc::Optional<bool> adapt_input_to_cpu_usage; | 277 // MediaConstraints, and WebRtcVideoEngine2 passes it on to the |
340 // Enable CPU adaptation smoothing? | 278 // codec options. |
341 rtc::Optional<bool> adapt_cpu_with_smoothing; | |
342 // Enable video adapt third? | |
343 rtc::Optional<bool> video_adapt_third; | |
344 // Enable denoising? | |
345 rtc::Optional<bool> video_noise_reduction; | 279 rtc::Optional<bool> video_noise_reduction; |
346 // Experimental: Enable WebRtc higher start bitrate? | |
347 rtc::Optional<int> video_start_bitrate; | |
348 // Enable WebRTC Cpu Overuse Detection, which is a new version of the CPU | 280 // Enable WebRTC Cpu Overuse Detection, which is a new version of the CPU |
349 // adaptation algorithm. So this option will override the | 281 // adaptation algorithm. So this option will override the |
350 // |adapt_input_to_cpu_usage|. | 282 // |adapt_input_to_cpu_usage|. WebRtcSession sets this from the |
283 // constraints. Checked in WebRtcVideoChannel2::OnLoadUpdate, where | |
284 // it's passed to | |
285 // VideoCapturer::video_adapter()->OnCpuResolutionRequest. | |
351 rtc::Optional<bool> cpu_overuse_detection; | 286 rtc::Optional<bool> cpu_overuse_detection; |
352 // Low threshold (t1) for cpu overuse adaptation. (Adapt up) | 287 // Use conference mode? VideoChannel::SetRemoteContent_w sets this |
353 // Metric: encode usage (m1). m1 < t1 => underuse. | 288 // from the MediaContentDescription. Used only by conference mode |
354 rtc::Optional<int> cpu_underuse_threshold; | 289 // screencast logic in |
355 // High threshold (t1) for cpu overuse adaptation. (Adapt down) | 290 // WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoderConfig. |
356 // Metric: encode usage (m1). m1 > t1 => overuse. | |
357 rtc::Optional<int> cpu_overuse_threshold; | |
358 // Low threshold (t2) for cpu overuse adaptation. (Adapt up) | |
359 // Metric: relative standard deviation of encode time (m2). | |
360 // Optional threshold. If set, (m1 < t1 && m2 < t2) => underuse. | |
361 // Note: t2 will have no effect if t1 is not set. | |
362 rtc::Optional<int> cpu_underuse_encode_rsd_threshold; | |
363 // High threshold (t2) for cpu overuse adaptation. (Adapt down) | |
364 // Metric: relative standard deviation of encode time (m2). | |
365 // Optional threshold. If set, (m1 > t1 || m2 > t2) => overuse. | |
366 // Note: t2 will have no effect if t1 is not set. | |
367 rtc::Optional<int> cpu_overuse_encode_rsd_threshold; | |
368 // Use encode usage for cpu detection. | |
369 rtc::Optional<bool> cpu_overuse_encode_usage; | |
370 // Use conference mode? | |
371 rtc::Optional<bool> conference_mode; | 291 rtc::Optional<bool> conference_mode; |
372 // Threshhold for process cpu adaptation. (Process limit) | 292 // Set DSCP value for packet sent from video channel. WebRtcSession |
373 rtc::Optional<float> process_adaptation_threshhold; | 293 // sets this from the constraints. WebRtcVideoChannel2::SetOptions |
374 // Low threshhold for cpu adaptation. (Adapt up) | 294 // uses it to select value for MediaChannel::SetDscp. |
375 rtc::Optional<float> system_low_adaptation_threshhold; | |
376 // High threshhold for cpu adaptation. (Adapt down) | |
377 rtc::Optional<float> system_high_adaptation_threshhold; | |
378 // Set DSCP value for packet sent from video channel. | |
379 rtc::Optional<bool> dscp; | 295 rtc::Optional<bool> dscp; |
380 // Enable WebRTC suspension of video. No video frames will be sent when the | 296 // Enable WebRTC suspension of video. No video frames will be sent when the |
381 // bitrate is below the configured minimum bitrate. | 297 // bitrate is below the configured minimum bitrate. |
298 // WebRtcSession sets this from the constraints. WebRtcVideoChannel2 | |
299 // copies it to VideoSendStream::Config::suspend_below_min_bitrate. | |
382 rtc::Optional<bool> suspend_below_min_bitrate; | 300 rtc::Optional<bool> suspend_below_min_bitrate; |
383 // Limit on the number of early receive channels that can be created. | 301 // Force screencast to use a minimum bitrate. WebRtcSession sets |
384 rtc::Optional<int> unsignalled_recv_stream_limit; | 302 // this from the constraints. Copied to the encoder config by |
385 // Enable use of simulcast adapter. | 303 // WebRtcVideoChannel2. |
386 rtc::Optional<bool> use_simulcast_adapter; | 304 // TODO(nisse): Document unit, there's an unexplained "* 1000" where |
pbos-webrtc
2016/01/27 11:41:30
Rename _kbps instead.
nisse-webrtc
2016/01/27 12:59:05
Done.
| |
387 // Force screencast to use a minimum bitrate | 305 // it is used. |
388 rtc::Optional<int> screencast_min_bitrate; | 306 rtc::Optional<int> screencast_min_bitrate; |
389 // Set to true if the renderer has an algorithm of frame selection. | 307 // Set to true if the renderer has an algorithm of frame selection. |
390 // If the value is true, then WebRTC will hand over a frame as soon as | 308 // If the value is true, then WebRTC will hand over a frame as soon as |
391 // possible without delay, and rendering smoothness is completely the duty | 309 // possible without delay, and rendering smoothness is completely the duty |
392 // of the renderer; | 310 // of the renderer; |
393 // If the value is false, then WebRTC is responsible to delay frame release | 311 // If the value is false, then WebRTC is responsible to delay frame release |
394 // in order to increase rendering smoothness. | 312 // in order to increase rendering smoothness. |
313 // | |
314 // WebRtcSession sets this from the RTCConfiguration. | |
315 // WebRtcVideoChannel2::AddRecvStream copies it to created | |
316 // WebRtcVideoReceiveStream, where it is returned by the | |
317 // SmoothsRenderedFrames method. This method is used by the | |
318 // VideoReceiveStream, where the value is passed on to the | |
319 // IncomingVideoStream constructor. | |
395 rtc::Optional<bool> disable_prerenderer_smoothing; | 320 rtc::Optional<bool> disable_prerenderer_smoothing; |
396 | 321 |
397 private: | 322 private: |
398 template <typename T> | 323 template <typename T> |
399 static void SetFrom(rtc::Optional<T>* s, const rtc::Optional<T>& o) { | 324 static void SetFrom(rtc::Optional<T>* s, const rtc::Optional<T>& o) { |
400 if (o) { | 325 if (o) { |
401 *s = o; | 326 *s = o; |
402 } | 327 } |
403 } | 328 } |
404 }; | 329 }; |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1208 // Signal when the media channel is ready to send the stream. Arguments are: | 1133 // Signal when the media channel is ready to send the stream. Arguments are: |
1209 // writable(bool) | 1134 // writable(bool) |
1210 sigslot::signal1<bool> SignalReadyToSend; | 1135 sigslot::signal1<bool> SignalReadyToSend; |
1211 // Signal for notifying that the remote side has closed the DataChannel. | 1136 // Signal for notifying that the remote side has closed the DataChannel. |
1212 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; | 1137 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; |
1213 }; | 1138 }; |
1214 | 1139 |
1215 } // namespace cricket | 1140 } // namespace cricket |
1216 | 1141 |
1217 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ | 1142 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ |
OLD | NEW |