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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 class AudioRenderer; | 55 class AudioRenderer; |
56 struct RtpHeader; | 56 struct RtpHeader; |
57 class ScreencastId; | 57 class ScreencastId; |
58 struct VideoFormat; | 58 struct VideoFormat; |
59 class VideoCapturer; | 59 class VideoCapturer; |
60 class VideoRenderer; | 60 class VideoRenderer; |
61 | 61 |
62 const int kMinRtpHeaderExtensionId = 1; | 62 const int kMinRtpHeaderExtensionId = 1; |
63 const int kMaxRtpHeaderExtensionId = 255; | 63 const int kMaxRtpHeaderExtensionId = 255; |
64 const int kScreencastDefaultFps = 5; | 64 const int kScreencastDefaultFps = 5; |
65 const int kHighStartBitrate = 1500; | |
66 | 65 |
67 // Used in AudioOptions and VideoOptions to signify "unset" values. | 66 // Used in AudioOptions and VideoOptions to signify "unset" values. |
68 template <class T> | 67 template <class T> |
69 class Settable { | 68 class Settable { |
70 public: | 69 public: |
71 Settable() : set_(false), val_() {} | 70 Settable() : set_(false), val_() {} |
72 explicit Settable(T val) : set_(true), val_(val) {} | 71 explicit Settable(T val) : set_(true), val_(val) {} |
73 | 72 |
74 bool IsSet() const { | 73 bool IsSet() const { |
75 return set_; | 74 return set_; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 Settable<bool> dscp; | 280 Settable<bool> dscp; |
282 // Enable combined audio+bandwidth BWE. | 281 // Enable combined audio+bandwidth BWE. |
283 Settable<bool> combined_audio_video_bwe; | 282 Settable<bool> combined_audio_video_bwe; |
284 }; | 283 }; |
285 | 284 |
286 // Options that can be applied to a VideoMediaChannel or a VideoMediaEngine. | 285 // Options that can be applied to a VideoMediaChannel or a VideoMediaEngine. |
287 // Used to be flags, but that makes it hard to selectively apply options. | 286 // Used to be flags, but that makes it hard to selectively apply options. |
288 // We are moving all of the setting of options to structs like this, | 287 // We are moving all of the setting of options to structs like this, |
289 // but some things currently still use flags. | 288 // but some things currently still use flags. |
290 struct VideoOptions { | 289 struct VideoOptions { |
291 enum HighestBitrate { | |
292 NORMAL, | |
293 HIGH, | |
294 VERY_HIGH | |
295 }; | |
296 | |
297 VideoOptions() { | 290 VideoOptions() { |
298 process_adaptation_threshhold.Set(kProcessCpuThreshold); | 291 process_adaptation_threshhold.Set(kProcessCpuThreshold); |
299 system_low_adaptation_threshhold.Set(kLowSystemCpuThreshold); | 292 system_low_adaptation_threshhold.Set(kLowSystemCpuThreshold); |
300 system_high_adaptation_threshhold.Set(kHighSystemCpuThreshold); | 293 system_high_adaptation_threshhold.Set(kHighSystemCpuThreshold); |
301 unsignalled_recv_stream_limit.Set(kNumDefaultUnsignalledVideoRecvStreams); | 294 unsignalled_recv_stream_limit.Set(kNumDefaultUnsignalledVideoRecvStreams); |
302 } | 295 } |
303 | 296 |
304 void SetAll(const VideoOptions& change) { | 297 void SetAll(const VideoOptions& change) { |
305 adapt_input_to_cpu_usage.SetFrom(change.adapt_input_to_cpu_usage); | 298 adapt_input_to_cpu_usage.SetFrom(change.adapt_input_to_cpu_usage); |
306 adapt_cpu_with_smoothing.SetFrom(change.adapt_cpu_with_smoothing); | 299 adapt_cpu_with_smoothing.SetFrom(change.adapt_cpu_with_smoothing); |
307 video_adapt_third.SetFrom(change.video_adapt_third); | 300 video_adapt_third.SetFrom(change.video_adapt_third); |
308 video_noise_reduction.SetFrom(change.video_noise_reduction); | 301 video_noise_reduction.SetFrom(change.video_noise_reduction); |
309 video_start_bitrate.SetFrom(change.video_start_bitrate); | 302 video_start_bitrate.SetFrom(change.video_start_bitrate); |
310 video_highest_bitrate.SetFrom(change.video_highest_bitrate); | |
311 cpu_overuse_detection.SetFrom(change.cpu_overuse_detection); | 303 cpu_overuse_detection.SetFrom(change.cpu_overuse_detection); |
312 cpu_underuse_threshold.SetFrom(change.cpu_underuse_threshold); | 304 cpu_underuse_threshold.SetFrom(change.cpu_underuse_threshold); |
313 cpu_overuse_threshold.SetFrom(change.cpu_overuse_threshold); | 305 cpu_overuse_threshold.SetFrom(change.cpu_overuse_threshold); |
314 cpu_underuse_encode_rsd_threshold.SetFrom( | 306 cpu_underuse_encode_rsd_threshold.SetFrom( |
315 change.cpu_underuse_encode_rsd_threshold); | 307 change.cpu_underuse_encode_rsd_threshold); |
316 cpu_overuse_encode_rsd_threshold.SetFrom( | 308 cpu_overuse_encode_rsd_threshold.SetFrom( |
317 change.cpu_overuse_encode_rsd_threshold); | 309 change.cpu_overuse_encode_rsd_threshold); |
318 cpu_overuse_encode_usage.SetFrom(change.cpu_overuse_encode_usage); | 310 cpu_overuse_encode_usage.SetFrom(change.cpu_overuse_encode_usage); |
319 conference_mode.SetFrom(change.conference_mode); | 311 conference_mode.SetFrom(change.conference_mode); |
320 process_adaptation_threshhold.SetFrom(change.process_adaptation_threshhold); | 312 process_adaptation_threshhold.SetFrom(change.process_adaptation_threshhold); |
321 system_low_adaptation_threshhold.SetFrom( | 313 system_low_adaptation_threshhold.SetFrom( |
322 change.system_low_adaptation_threshhold); | 314 change.system_low_adaptation_threshhold); |
323 system_high_adaptation_threshhold.SetFrom( | 315 system_high_adaptation_threshhold.SetFrom( |
324 change.system_high_adaptation_threshhold); | 316 change.system_high_adaptation_threshhold); |
325 dscp.SetFrom(change.dscp); | 317 dscp.SetFrom(change.dscp); |
326 suspend_below_min_bitrate.SetFrom(change.suspend_below_min_bitrate); | 318 suspend_below_min_bitrate.SetFrom(change.suspend_below_min_bitrate); |
327 unsignalled_recv_stream_limit.SetFrom(change.unsignalled_recv_stream_limit); | 319 unsignalled_recv_stream_limit.SetFrom(change.unsignalled_recv_stream_limit); |
328 use_simulcast_adapter.SetFrom(change.use_simulcast_adapter); | 320 use_simulcast_adapter.SetFrom(change.use_simulcast_adapter); |
329 screencast_min_bitrate.SetFrom(change.screencast_min_bitrate); | 321 screencast_min_bitrate.SetFrom(change.screencast_min_bitrate); |
330 } | 322 } |
331 | 323 |
332 bool operator==(const VideoOptions& o) const { | 324 bool operator==(const VideoOptions& o) const { |
333 return adapt_input_to_cpu_usage == o.adapt_input_to_cpu_usage && | 325 return adapt_input_to_cpu_usage == o.adapt_input_to_cpu_usage && |
334 adapt_cpu_with_smoothing == o.adapt_cpu_with_smoothing && | 326 adapt_cpu_with_smoothing == o.adapt_cpu_with_smoothing && |
335 video_adapt_third == o.video_adapt_third && | 327 video_adapt_third == o.video_adapt_third && |
336 video_noise_reduction == o.video_noise_reduction && | 328 video_noise_reduction == o.video_noise_reduction && |
337 video_start_bitrate == o.video_start_bitrate && | 329 video_start_bitrate == o.video_start_bitrate && |
338 video_highest_bitrate == o.video_highest_bitrate && | |
339 cpu_overuse_detection == o.cpu_overuse_detection && | 330 cpu_overuse_detection == o.cpu_overuse_detection && |
340 cpu_underuse_threshold == o.cpu_underuse_threshold && | 331 cpu_underuse_threshold == o.cpu_underuse_threshold && |
341 cpu_overuse_threshold == o.cpu_overuse_threshold && | 332 cpu_overuse_threshold == o.cpu_overuse_threshold && |
342 cpu_underuse_encode_rsd_threshold == | 333 cpu_underuse_encode_rsd_threshold == |
343 o.cpu_underuse_encode_rsd_threshold && | 334 o.cpu_underuse_encode_rsd_threshold && |
344 cpu_overuse_encode_rsd_threshold == | 335 cpu_overuse_encode_rsd_threshold == |
345 o.cpu_overuse_encode_rsd_threshold && | 336 o.cpu_overuse_encode_rsd_threshold && |
346 cpu_overuse_encode_usage == o.cpu_overuse_encode_usage && | 337 cpu_overuse_encode_usage == o.cpu_overuse_encode_usage && |
347 conference_mode == o.conference_mode && | 338 conference_mode == o.conference_mode && |
348 process_adaptation_threshhold == o.process_adaptation_threshhold && | 339 process_adaptation_threshhold == o.process_adaptation_threshhold && |
349 system_low_adaptation_threshhold == | 340 system_low_adaptation_threshhold == |
350 o.system_low_adaptation_threshhold && | 341 o.system_low_adaptation_threshhold && |
351 system_high_adaptation_threshhold == | 342 system_high_adaptation_threshhold == |
352 o.system_high_adaptation_threshhold && | 343 o.system_high_adaptation_threshhold && |
353 dscp == o.dscp && | 344 dscp == o.dscp && |
354 suspend_below_min_bitrate == o.suspend_below_min_bitrate && | 345 suspend_below_min_bitrate == o.suspend_below_min_bitrate && |
355 unsignalled_recv_stream_limit == o.unsignalled_recv_stream_limit && | 346 unsignalled_recv_stream_limit == o.unsignalled_recv_stream_limit && |
356 use_simulcast_adapter == o.use_simulcast_adapter && | 347 use_simulcast_adapter == o.use_simulcast_adapter && |
357 screencast_min_bitrate == o.screencast_min_bitrate; | 348 screencast_min_bitrate == o.screencast_min_bitrate; |
358 } | 349 } |
359 | 350 |
360 std::string ToString() const { | 351 std::string ToString() const { |
361 std::ostringstream ost; | 352 std::ostringstream ost; |
362 ost << "VideoOptions {"; | 353 ost << "VideoOptions {"; |
363 ost << ToStringIfSet("cpu adaption", adapt_input_to_cpu_usage); | 354 ost << ToStringIfSet("cpu adaption", adapt_input_to_cpu_usage); |
364 ost << ToStringIfSet("cpu adaptation smoothing", adapt_cpu_with_smoothing); | 355 ost << ToStringIfSet("cpu adaptation smoothing", adapt_cpu_with_smoothing); |
365 ost << ToStringIfSet("video adapt third", video_adapt_third); | 356 ost << ToStringIfSet("video adapt third", video_adapt_third); |
366 ost << ToStringIfSet("noise reduction", video_noise_reduction); | 357 ost << ToStringIfSet("noise reduction", video_noise_reduction); |
367 ost << ToStringIfSet("start bitrate", video_start_bitrate); | 358 ost << ToStringIfSet("start bitrate", video_start_bitrate); |
368 ost << ToStringIfSet("highest video bitrate", video_highest_bitrate); | |
369 ost << ToStringIfSet("cpu overuse detection", cpu_overuse_detection); | 359 ost << ToStringIfSet("cpu overuse detection", cpu_overuse_detection); |
370 ost << ToStringIfSet("cpu underuse threshold", cpu_underuse_threshold); | 360 ost << ToStringIfSet("cpu underuse threshold", cpu_underuse_threshold); |
371 ost << ToStringIfSet("cpu overuse threshold", cpu_overuse_threshold); | 361 ost << ToStringIfSet("cpu overuse threshold", cpu_overuse_threshold); |
372 ost << ToStringIfSet("cpu underuse encode rsd threshold", | 362 ost << ToStringIfSet("cpu underuse encode rsd threshold", |
373 cpu_underuse_encode_rsd_threshold); | 363 cpu_underuse_encode_rsd_threshold); |
374 ost << ToStringIfSet("cpu overuse encode rsd threshold", | 364 ost << ToStringIfSet("cpu overuse encode rsd threshold", |
375 cpu_overuse_encode_rsd_threshold); | 365 cpu_overuse_encode_rsd_threshold); |
376 ost << ToStringIfSet("cpu overuse encode usage", | 366 ost << ToStringIfSet("cpu overuse encode usage", |
377 cpu_overuse_encode_usage); | 367 cpu_overuse_encode_usage); |
378 ost << ToStringIfSet("conference mode", conference_mode); | 368 ost << ToStringIfSet("conference mode", conference_mode); |
(...skipping 14 matching lines...) Expand all Loading... |
393 // Enable CPU adaptation? | 383 // Enable CPU adaptation? |
394 Settable<bool> adapt_input_to_cpu_usage; | 384 Settable<bool> adapt_input_to_cpu_usage; |
395 // Enable CPU adaptation smoothing? | 385 // Enable CPU adaptation smoothing? |
396 Settable<bool> adapt_cpu_with_smoothing; | 386 Settable<bool> adapt_cpu_with_smoothing; |
397 // Enable video adapt third? | 387 // Enable video adapt third? |
398 Settable<bool> video_adapt_third; | 388 Settable<bool> video_adapt_third; |
399 // Enable denoising? | 389 // Enable denoising? |
400 Settable<bool> video_noise_reduction; | 390 Settable<bool> video_noise_reduction; |
401 // Experimental: Enable WebRtc higher start bitrate? | 391 // Experimental: Enable WebRtc higher start bitrate? |
402 Settable<int> video_start_bitrate; | 392 Settable<int> video_start_bitrate; |
403 // Set highest bitrate mode for video. | |
404 Settable<HighestBitrate> video_highest_bitrate; | |
405 // Enable WebRTC Cpu Overuse Detection, which is a new version of the CPU | 393 // Enable WebRTC Cpu Overuse Detection, which is a new version of the CPU |
406 // adaptation algorithm. So this option will override the | 394 // adaptation algorithm. So this option will override the |
407 // |adapt_input_to_cpu_usage|. | 395 // |adapt_input_to_cpu_usage|. |
408 Settable<bool> cpu_overuse_detection; | 396 Settable<bool> cpu_overuse_detection; |
409 // Low threshold (t1) for cpu overuse adaptation. (Adapt up) | 397 // Low threshold (t1) for cpu overuse adaptation. (Adapt up) |
410 // Metric: encode usage (m1). m1 < t1 => underuse. | 398 // Metric: encode usage (m1). m1 < t1 => underuse. |
411 Settable<int> cpu_underuse_threshold; | 399 Settable<int> cpu_underuse_threshold; |
412 // High threshold (t1) for cpu overuse adaptation. (Adapt down) | 400 // High threshold (t1) for cpu overuse adaptation. (Adapt down) |
413 // Metric: encode usage (m1). m1 > t1 => overuse. | 401 // Metric: encode usage (m1). m1 > t1 => overuse. |
414 Settable<int> cpu_overuse_threshold; | 402 Settable<int> cpu_overuse_threshold; |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 // Signal when the media channel is ready to send the stream. Arguments are: | 1248 // Signal when the media channel is ready to send the stream. Arguments are: |
1261 // writable(bool) | 1249 // writable(bool) |
1262 sigslot::signal1<bool> SignalReadyToSend; | 1250 sigslot::signal1<bool> SignalReadyToSend; |
1263 // Signal for notifying that the remote side has closed the DataChannel. | 1251 // Signal for notifying that the remote side has closed the DataChannel. |
1264 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; | 1252 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; |
1265 }; | 1253 }; |
1266 | 1254 |
1267 } // namespace cricket | 1255 } // namespace cricket |
1268 | 1256 |
1269 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ | 1257 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ |
OLD | NEW |