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 20 matching lines...) Expand all Loading... |
31 #include <string> | 31 #include <string> |
32 #include <vector> | 32 #include <vector> |
33 | 33 |
34 #include "talk/media/base/codec.h" | 34 #include "talk/media/base/codec.h" |
35 #include "talk/media/base/constants.h" | 35 #include "talk/media/base/constants.h" |
36 #include "talk/media/base/streamparams.h" | 36 #include "talk/media/base/streamparams.h" |
37 #include "webrtc/base/basictypes.h" | 37 #include "webrtc/base/basictypes.h" |
38 #include "webrtc/base/buffer.h" | 38 #include "webrtc/base/buffer.h" |
39 #include "webrtc/base/dscp.h" | 39 #include "webrtc/base/dscp.h" |
40 #include "webrtc/base/logging.h" | 40 #include "webrtc/base/logging.h" |
41 #include "webrtc/base/maybe.h" | 41 #include "webrtc/base/optional.h" |
42 #include "webrtc/base/sigslot.h" | 42 #include "webrtc/base/sigslot.h" |
43 #include "webrtc/base/socket.h" | 43 #include "webrtc/base/socket.h" |
44 #include "webrtc/base/window.h" | 44 #include "webrtc/base/window.h" |
45 // TODO(juberti): re-evaluate this include | 45 // TODO(juberti): re-evaluate this include |
46 #include "talk/session/media/audiomonitor.h" | 46 #include "talk/session/media/audiomonitor.h" |
47 | 47 |
48 namespace rtc { | 48 namespace rtc { |
49 class Buffer; | 49 class Buffer; |
50 class RateLimiter; | 50 class RateLimiter; |
51 class Timing; | 51 class Timing; |
52 } | 52 } |
53 | 53 |
54 namespace cricket { | 54 namespace cricket { |
55 | 55 |
56 class AudioRenderer; | 56 class AudioRenderer; |
57 struct RtpHeader; | 57 struct RtpHeader; |
58 class ScreencastId; | 58 class ScreencastId; |
59 struct VideoFormat; | 59 struct VideoFormat; |
60 class VideoCapturer; | 60 class VideoCapturer; |
61 class VideoRenderer; | 61 class VideoRenderer; |
62 | 62 |
63 const int kMinRtpHeaderExtensionId = 1; | 63 const int kMinRtpHeaderExtensionId = 1; |
64 const int kMaxRtpHeaderExtensionId = 255; | 64 const int kMaxRtpHeaderExtensionId = 255; |
65 const int kScreencastDefaultFps = 5; | 65 const int kScreencastDefaultFps = 5; |
66 | 66 |
67 template <class T> | 67 template <class T> |
68 static std::string ToStringIfSet(const char* key, const rtc::Maybe<T>& val) { | 68 static std::string ToStringIfSet(const char* key, const rtc::Optional<T>& val) { |
69 std::string str; | 69 std::string str; |
70 if (val) { | 70 if (val) { |
71 str = key; | 71 str = key; |
72 str += ": "; | 72 str += ": "; |
73 str += val ? rtc::ToString(*val) : ""; | 73 str += val ? rtc::ToString(*val) : ""; |
74 str += ", "; | 74 str += ", "; |
75 } | 75 } |
76 return str; | 76 return str; |
77 } | 77 } |
78 | 78 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 ost << ToStringIfSet("recording_sample_rate", recording_sample_rate); | 179 ost << ToStringIfSet("recording_sample_rate", recording_sample_rate); |
180 ost << ToStringIfSet("playout_sample_rate", playout_sample_rate); | 180 ost << ToStringIfSet("playout_sample_rate", playout_sample_rate); |
181 ost << ToStringIfSet("dscp", dscp); | 181 ost << ToStringIfSet("dscp", dscp); |
182 ost << ToStringIfSet("combined_audio_video_bwe", combined_audio_video_bwe); | 182 ost << ToStringIfSet("combined_audio_video_bwe", combined_audio_video_bwe); |
183 ost << "}"; | 183 ost << "}"; |
184 return ost.str(); | 184 return ost.str(); |
185 } | 185 } |
186 | 186 |
187 // Audio processing that attempts to filter away the output signal from | 187 // Audio processing that attempts to filter away the output signal from |
188 // later inbound pickup. | 188 // later inbound pickup. |
189 rtc::Maybe<bool> echo_cancellation; | 189 rtc::Optional<bool> echo_cancellation; |
190 // Audio processing to adjust the sensitivity of the local mic dynamically. | 190 // Audio processing to adjust the sensitivity of the local mic dynamically. |
191 rtc::Maybe<bool> auto_gain_control; | 191 rtc::Optional<bool> auto_gain_control; |
192 // Audio processing to filter out background noise. | 192 // Audio processing to filter out background noise. |
193 rtc::Maybe<bool> noise_suppression; | 193 rtc::Optional<bool> noise_suppression; |
194 // Audio processing to remove background noise of lower frequencies. | 194 // Audio processing to remove background noise of lower frequencies. |
195 rtc::Maybe<bool> highpass_filter; | 195 rtc::Optional<bool> highpass_filter; |
196 // Audio processing to swap the left and right channels. | 196 // Audio processing to swap the left and right channels. |
197 rtc::Maybe<bool> stereo_swapping; | 197 rtc::Optional<bool> stereo_swapping; |
198 // Audio receiver jitter buffer (NetEq) max capacity in number of packets. | 198 // Audio receiver jitter buffer (NetEq) max capacity in number of packets. |
199 rtc::Maybe<int> audio_jitter_buffer_max_packets; | 199 rtc::Optional<int> audio_jitter_buffer_max_packets; |
200 // Audio receiver jitter buffer (NetEq) fast accelerate mode. | 200 // Audio receiver jitter buffer (NetEq) fast accelerate mode. |
201 rtc::Maybe<bool> audio_jitter_buffer_fast_accelerate; | 201 rtc::Optional<bool> audio_jitter_buffer_fast_accelerate; |
202 // Audio processing to detect typing. | 202 // Audio processing to detect typing. |
203 rtc::Maybe<bool> typing_detection; | 203 rtc::Optional<bool> typing_detection; |
204 rtc::Maybe<bool> aecm_generate_comfort_noise; | 204 rtc::Optional<bool> aecm_generate_comfort_noise; |
205 rtc::Maybe<bool> conference_mode; | 205 rtc::Optional<bool> conference_mode; |
206 rtc::Maybe<int> adjust_agc_delta; | 206 rtc::Optional<int> adjust_agc_delta; |
207 rtc::Maybe<bool> experimental_agc; | 207 rtc::Optional<bool> experimental_agc; |
208 rtc::Maybe<bool> extended_filter_aec; | 208 rtc::Optional<bool> extended_filter_aec; |
209 rtc::Maybe<bool> delay_agnostic_aec; | 209 rtc::Optional<bool> delay_agnostic_aec; |
210 rtc::Maybe<bool> experimental_ns; | 210 rtc::Optional<bool> experimental_ns; |
211 rtc::Maybe<bool> aec_dump; | 211 rtc::Optional<bool> aec_dump; |
212 // Note that tx_agc_* only applies to non-experimental AGC. | 212 // Note that tx_agc_* only applies to non-experimental AGC. |
213 rtc::Maybe<uint16_t> tx_agc_target_dbov; | 213 rtc::Optional<uint16_t> tx_agc_target_dbov; |
214 rtc::Maybe<uint16_t> tx_agc_digital_compression_gain; | 214 rtc::Optional<uint16_t> tx_agc_digital_compression_gain; |
215 rtc::Maybe<bool> tx_agc_limiter; | 215 rtc::Optional<bool> tx_agc_limiter; |
216 rtc::Maybe<uint32_t> recording_sample_rate; | 216 rtc::Optional<uint32_t> recording_sample_rate; |
217 rtc::Maybe<uint32_t> playout_sample_rate; | 217 rtc::Optional<uint32_t> playout_sample_rate; |
218 // Set DSCP value for packet sent from audio channel. | 218 // Set DSCP value for packet sent from audio channel. |
219 rtc::Maybe<bool> dscp; | 219 rtc::Optional<bool> dscp; |
220 // Enable combined audio+bandwidth BWE. | 220 // Enable combined audio+bandwidth BWE. |
221 rtc::Maybe<bool> combined_audio_video_bwe; | 221 rtc::Optional<bool> combined_audio_video_bwe; |
222 | 222 |
223 private: | 223 private: |
224 template <typename T> | 224 template <typename T> |
225 static void SetFrom(rtc::Maybe<T>* s, const rtc::Maybe<T>& o) { | 225 static void SetFrom(rtc::Optional<T>* s, const rtc::Optional<T>& o) { |
226 if (o) { | 226 if (o) { |
227 *s = o; | 227 *s = o; |
228 } | 228 } |
229 } | 229 } |
230 }; | 230 }; |
231 | 231 |
232 // Options that can be applied to a VideoMediaChannel or a VideoMediaEngine. | 232 // Options that can be applied to a VideoMediaChannel or a VideoMediaEngine. |
233 // Used to be flags, but that makes it hard to selectively apply options. | 233 // Used to be flags, but that makes it hard to selectively apply options. |
234 // We are moving all of the setting of options to structs like this, | 234 // We are moving all of the setting of options to structs like this, |
235 // but some things currently still use flags. | 235 // but some things currently still use flags. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 suspend_below_min_bitrate); | 322 suspend_below_min_bitrate); |
323 ost << ToStringIfSet("num channels for early receive", | 323 ost << ToStringIfSet("num channels for early receive", |
324 unsignalled_recv_stream_limit); | 324 unsignalled_recv_stream_limit); |
325 ost << ToStringIfSet("use simulcast adapter", use_simulcast_adapter); | 325 ost << ToStringIfSet("use simulcast adapter", use_simulcast_adapter); |
326 ost << ToStringIfSet("screencast min bitrate", screencast_min_bitrate); | 326 ost << ToStringIfSet("screencast min bitrate", screencast_min_bitrate); |
327 ost << "}"; | 327 ost << "}"; |
328 return ost.str(); | 328 return ost.str(); |
329 } | 329 } |
330 | 330 |
331 // Enable CPU adaptation? | 331 // Enable CPU adaptation? |
332 rtc::Maybe<bool> adapt_input_to_cpu_usage; | 332 rtc::Optional<bool> adapt_input_to_cpu_usage; |
333 // Enable CPU adaptation smoothing? | 333 // Enable CPU adaptation smoothing? |
334 rtc::Maybe<bool> adapt_cpu_with_smoothing; | 334 rtc::Optional<bool> adapt_cpu_with_smoothing; |
335 // Enable video adapt third? | 335 // Enable video adapt third? |
336 rtc::Maybe<bool> video_adapt_third; | 336 rtc::Optional<bool> video_adapt_third; |
337 // Enable denoising? | 337 // Enable denoising? |
338 rtc::Maybe<bool> video_noise_reduction; | 338 rtc::Optional<bool> video_noise_reduction; |
339 // Experimental: Enable WebRtc higher start bitrate? | 339 // Experimental: Enable WebRtc higher start bitrate? |
340 rtc::Maybe<int> video_start_bitrate; | 340 rtc::Optional<int> video_start_bitrate; |
341 // Enable WebRTC Cpu Overuse Detection, which is a new version of the CPU | 341 // Enable WebRTC Cpu Overuse Detection, which is a new version of the CPU |
342 // adaptation algorithm. So this option will override the | 342 // adaptation algorithm. So this option will override the |
343 // |adapt_input_to_cpu_usage|. | 343 // |adapt_input_to_cpu_usage|. |
344 rtc::Maybe<bool> cpu_overuse_detection; | 344 rtc::Optional<bool> cpu_overuse_detection; |
345 // Low threshold (t1) for cpu overuse adaptation. (Adapt up) | 345 // Low threshold (t1) for cpu overuse adaptation. (Adapt up) |
346 // Metric: encode usage (m1). m1 < t1 => underuse. | 346 // Metric: encode usage (m1). m1 < t1 => underuse. |
347 rtc::Maybe<int> cpu_underuse_threshold; | 347 rtc::Optional<int> cpu_underuse_threshold; |
348 // High threshold (t1) for cpu overuse adaptation. (Adapt down) | 348 // High threshold (t1) for cpu overuse adaptation. (Adapt down) |
349 // Metric: encode usage (m1). m1 > t1 => overuse. | 349 // Metric: encode usage (m1). m1 > t1 => overuse. |
350 rtc::Maybe<int> cpu_overuse_threshold; | 350 rtc::Optional<int> cpu_overuse_threshold; |
351 // Low threshold (t2) for cpu overuse adaptation. (Adapt up) | 351 // Low threshold (t2) for cpu overuse adaptation. (Adapt up) |
352 // Metric: relative standard deviation of encode time (m2). | 352 // Metric: relative standard deviation of encode time (m2). |
353 // Optional threshold. If set, (m1 < t1 && m2 < t2) => underuse. | 353 // Optional threshold. If set, (m1 < t1 && m2 < t2) => underuse. |
354 // Note: t2 will have no effect if t1 is not set. | 354 // Note: t2 will have no effect if t1 is not set. |
355 rtc::Maybe<int> cpu_underuse_encode_rsd_threshold; | 355 rtc::Optional<int> cpu_underuse_encode_rsd_threshold; |
356 // High threshold (t2) for cpu overuse adaptation. (Adapt down) | 356 // High threshold (t2) for cpu overuse adaptation. (Adapt down) |
357 // Metric: relative standard deviation of encode time (m2). | 357 // Metric: relative standard deviation of encode time (m2). |
358 // Optional threshold. If set, (m1 > t1 || m2 > t2) => overuse. | 358 // Optional threshold. If set, (m1 > t1 || m2 > t2) => overuse. |
359 // Note: t2 will have no effect if t1 is not set. | 359 // Note: t2 will have no effect if t1 is not set. |
360 rtc::Maybe<int> cpu_overuse_encode_rsd_threshold; | 360 rtc::Optional<int> cpu_overuse_encode_rsd_threshold; |
361 // Use encode usage for cpu detection. | 361 // Use encode usage for cpu detection. |
362 rtc::Maybe<bool> cpu_overuse_encode_usage; | 362 rtc::Optional<bool> cpu_overuse_encode_usage; |
363 // Use conference mode? | 363 // Use conference mode? |
364 rtc::Maybe<bool> conference_mode; | 364 rtc::Optional<bool> conference_mode; |
365 // Threshhold for process cpu adaptation. (Process limit) | 365 // Threshhold for process cpu adaptation. (Process limit) |
366 rtc::Maybe<float> process_adaptation_threshhold; | 366 rtc::Optional<float> process_adaptation_threshhold; |
367 // Low threshhold for cpu adaptation. (Adapt up) | 367 // Low threshhold for cpu adaptation. (Adapt up) |
368 rtc::Maybe<float> system_low_adaptation_threshhold; | 368 rtc::Optional<float> system_low_adaptation_threshhold; |
369 // High threshhold for cpu adaptation. (Adapt down) | 369 // High threshhold for cpu adaptation. (Adapt down) |
370 rtc::Maybe<float> system_high_adaptation_threshhold; | 370 rtc::Optional<float> system_high_adaptation_threshhold; |
371 // Set DSCP value for packet sent from video channel. | 371 // Set DSCP value for packet sent from video channel. |
372 rtc::Maybe<bool> dscp; | 372 rtc::Optional<bool> dscp; |
373 // Enable WebRTC suspension of video. No video frames will be sent when the | 373 // Enable WebRTC suspension of video. No video frames will be sent when the |
374 // bitrate is below the configured minimum bitrate. | 374 // bitrate is below the configured minimum bitrate. |
375 rtc::Maybe<bool> suspend_below_min_bitrate; | 375 rtc::Optional<bool> suspend_below_min_bitrate; |
376 // Limit on the number of early receive channels that can be created. | 376 // Limit on the number of early receive channels that can be created. |
377 rtc::Maybe<int> unsignalled_recv_stream_limit; | 377 rtc::Optional<int> unsignalled_recv_stream_limit; |
378 // Enable use of simulcast adapter. | 378 // Enable use of simulcast adapter. |
379 rtc::Maybe<bool> use_simulcast_adapter; | 379 rtc::Optional<bool> use_simulcast_adapter; |
380 // Force screencast to use a minimum bitrate | 380 // Force screencast to use a minimum bitrate |
381 rtc::Maybe<int> screencast_min_bitrate; | 381 rtc::Optional<int> screencast_min_bitrate; |
382 | 382 |
383 private: | 383 private: |
384 template <typename T> | 384 template <typename T> |
385 static void SetFrom(rtc::Maybe<T>* s, const rtc::Maybe<T>& o) { | 385 static void SetFrom(rtc::Optional<T>* s, const rtc::Optional<T>& o) { |
386 if (o) { | 386 if (o) { |
387 *s = o; | 387 *s = o; |
388 } | 388 } |
389 } | 389 } |
390 }; | 390 }; |
391 | 391 |
392 struct RtpHeaderExtension { | 392 struct RtpHeaderExtension { |
393 RtpHeaderExtension() : id(0) {} | 393 RtpHeaderExtension() : id(0) {} |
394 RtpHeaderExtension(const std::string& u, int i) : uri(u), id(i) {} | 394 RtpHeaderExtension(const std::string& u, int i) : uri(u), id(i) {} |
395 | 395 |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 // Signal when the media channel is ready to send the stream. Arguments are: | 1204 // Signal when the media channel is ready to send the stream. Arguments are: |
1205 // writable(bool) | 1205 // writable(bool) |
1206 sigslot::signal1<bool> SignalReadyToSend; | 1206 sigslot::signal1<bool> SignalReadyToSend; |
1207 // Signal for notifying that the remote side has closed the DataChannel. | 1207 // Signal for notifying that the remote side has closed the DataChannel. |
1208 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; | 1208 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; |
1209 }; | 1209 }; |
1210 | 1210 |
1211 } // namespace cricket | 1211 } // namespace cricket |
1212 | 1212 |
1213 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ | 1213 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ |
OLD | NEW |