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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 change.cpu_underuse_encode_rsd_threshold); | 320 change.cpu_underuse_encode_rsd_threshold); |
321 cpu_overuse_encode_rsd_threshold.SetFrom( | 321 cpu_overuse_encode_rsd_threshold.SetFrom( |
322 change.cpu_overuse_encode_rsd_threshold); | 322 change.cpu_overuse_encode_rsd_threshold); |
323 cpu_overuse_encode_usage.SetFrom(change.cpu_overuse_encode_usage); | 323 cpu_overuse_encode_usage.SetFrom(change.cpu_overuse_encode_usage); |
324 conference_mode.SetFrom(change.conference_mode); | 324 conference_mode.SetFrom(change.conference_mode); |
325 process_adaptation_threshhold.SetFrom(change.process_adaptation_threshhold); | 325 process_adaptation_threshhold.SetFrom(change.process_adaptation_threshhold); |
326 system_low_adaptation_threshhold.SetFrom( | 326 system_low_adaptation_threshhold.SetFrom( |
327 change.system_low_adaptation_threshhold); | 327 change.system_low_adaptation_threshhold); |
328 system_high_adaptation_threshhold.SetFrom( | 328 system_high_adaptation_threshhold.SetFrom( |
329 change.system_high_adaptation_threshhold); | 329 change.system_high_adaptation_threshhold); |
330 buffered_mode_latency.SetFrom(change.buffered_mode_latency); | |
331 dscp.SetFrom(change.dscp); | 330 dscp.SetFrom(change.dscp); |
332 suspend_below_min_bitrate.SetFrom(change.suspend_below_min_bitrate); | 331 suspend_below_min_bitrate.SetFrom(change.suspend_below_min_bitrate); |
333 unsignalled_recv_stream_limit.SetFrom(change.unsignalled_recv_stream_limit); | 332 unsignalled_recv_stream_limit.SetFrom(change.unsignalled_recv_stream_limit); |
334 use_simulcast_adapter.SetFrom(change.use_simulcast_adapter); | 333 use_simulcast_adapter.SetFrom(change.use_simulcast_adapter); |
335 screencast_min_bitrate.SetFrom(change.screencast_min_bitrate); | 334 screencast_min_bitrate.SetFrom(change.screencast_min_bitrate); |
336 } | 335 } |
337 | 336 |
338 bool operator==(const VideoOptions& o) const { | 337 bool operator==(const VideoOptions& o) const { |
339 return adapt_input_to_cpu_usage == o.adapt_input_to_cpu_usage && | 338 return adapt_input_to_cpu_usage == o.adapt_input_to_cpu_usage && |
340 adapt_cpu_with_smoothing == o.adapt_cpu_with_smoothing && | 339 adapt_cpu_with_smoothing == o.adapt_cpu_with_smoothing && |
341 video_adapt_third == o.video_adapt_third && | 340 video_adapt_third == o.video_adapt_third && |
342 video_noise_reduction == o.video_noise_reduction && | 341 video_noise_reduction == o.video_noise_reduction && |
343 video_start_bitrate == o.video_start_bitrate && | 342 video_start_bitrate == o.video_start_bitrate && |
344 video_highest_bitrate == o.video_highest_bitrate && | 343 video_highest_bitrate == o.video_highest_bitrate && |
345 cpu_overuse_detection == o.cpu_overuse_detection && | 344 cpu_overuse_detection == o.cpu_overuse_detection && |
346 cpu_underuse_threshold == o.cpu_underuse_threshold && | 345 cpu_underuse_threshold == o.cpu_underuse_threshold && |
347 cpu_overuse_threshold == o.cpu_overuse_threshold && | 346 cpu_overuse_threshold == o.cpu_overuse_threshold && |
348 cpu_underuse_encode_rsd_threshold == | 347 cpu_underuse_encode_rsd_threshold == |
349 o.cpu_underuse_encode_rsd_threshold && | 348 o.cpu_underuse_encode_rsd_threshold && |
350 cpu_overuse_encode_rsd_threshold == | 349 cpu_overuse_encode_rsd_threshold == |
351 o.cpu_overuse_encode_rsd_threshold && | 350 o.cpu_overuse_encode_rsd_threshold && |
352 cpu_overuse_encode_usage == o.cpu_overuse_encode_usage && | 351 cpu_overuse_encode_usage == o.cpu_overuse_encode_usage && |
353 conference_mode == o.conference_mode && | 352 conference_mode == o.conference_mode && |
354 process_adaptation_threshhold == o.process_adaptation_threshhold && | 353 process_adaptation_threshhold == o.process_adaptation_threshhold && |
355 system_low_adaptation_threshhold == | 354 system_low_adaptation_threshhold == |
356 o.system_low_adaptation_threshhold && | 355 o.system_low_adaptation_threshhold && |
357 system_high_adaptation_threshhold == | 356 system_high_adaptation_threshhold == |
358 o.system_high_adaptation_threshhold && | 357 o.system_high_adaptation_threshhold && |
359 buffered_mode_latency == o.buffered_mode_latency && dscp == o.dscp && | 358 dscp == o.dscp && |
360 suspend_below_min_bitrate == o.suspend_below_min_bitrate && | 359 suspend_below_min_bitrate == o.suspend_below_min_bitrate && |
361 unsignalled_recv_stream_limit == o.unsignalled_recv_stream_limit && | 360 unsignalled_recv_stream_limit == o.unsignalled_recv_stream_limit && |
362 use_simulcast_adapter == o.use_simulcast_adapter && | 361 use_simulcast_adapter == o.use_simulcast_adapter && |
363 screencast_min_bitrate == o.screencast_min_bitrate; | 362 screencast_min_bitrate == o.screencast_min_bitrate; |
364 } | 363 } |
365 | 364 |
366 std::string ToString() const { | 365 std::string ToString() const { |
367 std::ostringstream ost; | 366 std::ostringstream ost; |
368 ost << "VideoOptions {"; | 367 ost << "VideoOptions {"; |
369 ost << ToStringIfSet("cpu adaption", adapt_input_to_cpu_usage); | 368 ost << ToStringIfSet("cpu adaption", adapt_input_to_cpu_usage); |
370 ost << ToStringIfSet("cpu adaptation smoothing", adapt_cpu_with_smoothing); | 369 ost << ToStringIfSet("cpu adaptation smoothing", adapt_cpu_with_smoothing); |
371 ost << ToStringIfSet("video adapt third", video_adapt_third); | 370 ost << ToStringIfSet("video adapt third", video_adapt_third); |
372 ost << ToStringIfSet("noise reduction", video_noise_reduction); | 371 ost << ToStringIfSet("noise reduction", video_noise_reduction); |
373 ost << ToStringIfSet("start bitrate", video_start_bitrate); | 372 ost << ToStringIfSet("start bitrate", video_start_bitrate); |
374 ost << ToStringIfSet("highest video bitrate", video_highest_bitrate); | 373 ost << ToStringIfSet("highest video bitrate", video_highest_bitrate); |
375 ost << ToStringIfSet("cpu overuse detection", cpu_overuse_detection); | 374 ost << ToStringIfSet("cpu overuse detection", cpu_overuse_detection); |
376 ost << ToStringIfSet("cpu underuse threshold", cpu_underuse_threshold); | 375 ost << ToStringIfSet("cpu underuse threshold", cpu_underuse_threshold); |
377 ost << ToStringIfSet("cpu overuse threshold", cpu_overuse_threshold); | 376 ost << ToStringIfSet("cpu overuse threshold", cpu_overuse_threshold); |
378 ost << ToStringIfSet("cpu underuse encode rsd threshold", | 377 ost << ToStringIfSet("cpu underuse encode rsd threshold", |
379 cpu_underuse_encode_rsd_threshold); | 378 cpu_underuse_encode_rsd_threshold); |
380 ost << ToStringIfSet("cpu overuse encode rsd threshold", | 379 ost << ToStringIfSet("cpu overuse encode rsd threshold", |
381 cpu_overuse_encode_rsd_threshold); | 380 cpu_overuse_encode_rsd_threshold); |
382 ost << ToStringIfSet("cpu overuse encode usage", | 381 ost << ToStringIfSet("cpu overuse encode usage", |
383 cpu_overuse_encode_usage); | 382 cpu_overuse_encode_usage); |
384 ost << ToStringIfSet("conference mode", conference_mode); | 383 ost << ToStringIfSet("conference mode", conference_mode); |
385 ost << ToStringIfSet("process", process_adaptation_threshhold); | 384 ost << ToStringIfSet("process", process_adaptation_threshhold); |
386 ost << ToStringIfSet("low", system_low_adaptation_threshhold); | 385 ost << ToStringIfSet("low", system_low_adaptation_threshhold); |
387 ost << ToStringIfSet("high", system_high_adaptation_threshhold); | 386 ost << ToStringIfSet("high", system_high_adaptation_threshhold); |
388 ost << ToStringIfSet("buffered mode latency", buffered_mode_latency); | |
389 ost << ToStringIfSet("dscp", dscp); | 387 ost << ToStringIfSet("dscp", dscp); |
390 ost << ToStringIfSet("suspend below min bitrate", | 388 ost << ToStringIfSet("suspend below min bitrate", |
391 suspend_below_min_bitrate); | 389 suspend_below_min_bitrate); |
392 ost << ToStringIfSet("num channels for early receive", | 390 ost << ToStringIfSet("num channels for early receive", |
393 unsignalled_recv_stream_limit); | 391 unsignalled_recv_stream_limit); |
394 ost << ToStringIfSet("use simulcast adapter", use_simulcast_adapter); | 392 ost << ToStringIfSet("use simulcast adapter", use_simulcast_adapter); |
395 ost << ToStringIfSet("screencast min bitrate", screencast_min_bitrate); | 393 ost << ToStringIfSet("screencast min bitrate", screencast_min_bitrate); |
396 ost << "}"; | 394 ost << "}"; |
397 return ost.str(); | 395 return ost.str(); |
398 } | 396 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
432 // Use encode usage for cpu detection. | 430 // Use encode usage for cpu detection. |
433 Settable<bool> cpu_overuse_encode_usage; | 431 Settable<bool> cpu_overuse_encode_usage; |
434 // Use conference mode? | 432 // Use conference mode? |
435 Settable<bool> conference_mode; | 433 Settable<bool> conference_mode; |
436 // Threshhold for process cpu adaptation. (Process limit) | 434 // Threshhold for process cpu adaptation. (Process limit) |
437 Settable<float> process_adaptation_threshhold; | 435 Settable<float> process_adaptation_threshhold; |
438 // Low threshhold for cpu adaptation. (Adapt up) | 436 // Low threshhold for cpu adaptation. (Adapt up) |
439 Settable<float> system_low_adaptation_threshhold; | 437 Settable<float> system_low_adaptation_threshhold; |
440 // High threshhold for cpu adaptation. (Adapt down) | 438 // High threshhold for cpu adaptation. (Adapt down) |
441 Settable<float> system_high_adaptation_threshhold; | 439 Settable<float> system_high_adaptation_threshhold; |
442 // Specify buffered mode latency in milliseconds. | |
443 Settable<int> buffered_mode_latency; | |
444 // Set DSCP value for packet sent from video channel. | 440 // Set DSCP value for packet sent from video channel. |
445 Settable<bool> dscp; | 441 Settable<bool> dscp; |
446 // Enable WebRTC suspension of video. No video frames will be sent when the | 442 // Enable WebRTC suspension of video. No video frames will be sent when the |
447 // bitrate is below the configured minimum bitrate. | 443 // bitrate is below the configured minimum bitrate. |
448 Settable<bool> suspend_below_min_bitrate; | 444 Settable<bool> suspend_below_min_bitrate; |
449 // Limit on the number of early receive channels that can be created. | 445 // Limit on the number of early receive channels that can be created. |
450 Settable<int> unsignalled_recv_stream_limit; | 446 Settable<int> unsignalled_recv_stream_limit; |
451 // Enable use of simulcast adapter. | 447 // Enable use of simulcast adapter. |
452 Settable<bool> use_simulcast_adapter; | 448 Settable<bool> use_simulcast_adapter; |
453 // Force screencast to use a minimum bitrate | 449 // Force screencast to use a minimum bitrate |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
982 | 978 |
983 struct DataMediaInfo { | 979 struct DataMediaInfo { |
984 void Clear() { | 980 void Clear() { |
985 senders.clear(); | 981 senders.clear(); |
986 receivers.clear(); | 982 receivers.clear(); |
987 } | 983 } |
988 std::vector<DataSenderInfo> senders; | 984 std::vector<DataSenderInfo> senders; |
989 std::vector<DataReceiverInfo> receivers; | 985 std::vector<DataReceiverInfo> receivers; |
990 }; | 986 }; |
991 | 987 |
988 struct AudioSendParameters { | |
pbos-webrtc
2015/07/11 08:48:16
Can I has ToString() methods on all of these for l
pthatcher1
2015/07/13 22:58:27
Done.
| |
989 std::vector<AudioCodec> codecs; | |
990 std::vector<RtpHeaderExtension> extensions; | |
991 // TODO(pthatcher): Move max_bandwidth_bps into AudioOptions. | |
992 int max_bandwidth_bps; | |
993 AudioOptions options; | |
994 // TODO(pthatcher): Add "remote" streams. | |
995 }; | |
996 | |
997 struct AudioRecvParameters { | |
998 std::vector<AudioCodec> codecs; | |
999 std::vector<RtpHeaderExtension> extensions; | |
1000 // TODO(pthatcher): Add "local" streams. | |
1001 }; | |
1002 | |
992 class VoiceMediaChannel : public MediaChannel { | 1003 class VoiceMediaChannel : public MediaChannel { |
993 public: | 1004 public: |
994 enum Error { | 1005 enum Error { |
995 ERROR_NONE = 0, // No error. | 1006 ERROR_NONE = 0, // No error. |
996 ERROR_OTHER, // Other errors. | 1007 ERROR_OTHER, // Other errors. |
997 ERROR_REC_DEVICE_OPEN_FAILED = 100, // Could not open mic. | 1008 ERROR_REC_DEVICE_OPEN_FAILED = 100, // Could not open mic. |
998 ERROR_REC_DEVICE_MUTED, // Mic was muted by OS. | 1009 ERROR_REC_DEVICE_MUTED, // Mic was muted by OS. |
999 ERROR_REC_DEVICE_SILENT, // No background noise picked up. | 1010 ERROR_REC_DEVICE_SILENT, // No background noise picked up. |
1000 ERROR_REC_DEVICE_SATURATION, // Mic input is clipping. | 1011 ERROR_REC_DEVICE_SATURATION, // Mic input is clipping. |
1001 ERROR_REC_DEVICE_REMOVED, // Mic was removed while active. | 1012 ERROR_REC_DEVICE_REMOVED, // Mic was removed while active. |
1002 ERROR_REC_RUNTIME_ERROR, // Processing is encountering errors. | 1013 ERROR_REC_RUNTIME_ERROR, // Processing is encountering errors. |
1003 ERROR_REC_SRTP_ERROR, // Generic SRTP failure. | 1014 ERROR_REC_SRTP_ERROR, // Generic SRTP failure. |
1004 ERROR_REC_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 1015 ERROR_REC_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
1005 ERROR_REC_TYPING_NOISE_DETECTED, // Typing noise is detected. | 1016 ERROR_REC_TYPING_NOISE_DETECTED, // Typing noise is detected. |
1006 ERROR_PLAY_DEVICE_OPEN_FAILED = 200, // Could not open playout. | 1017 ERROR_PLAY_DEVICE_OPEN_FAILED = 200, // Could not open playout. |
1007 ERROR_PLAY_DEVICE_MUTED, // Playout muted by OS. | 1018 ERROR_PLAY_DEVICE_MUTED, // Playout muted by OS. |
1008 ERROR_PLAY_DEVICE_REMOVED, // Playout removed while active. | 1019 ERROR_PLAY_DEVICE_REMOVED, // Playout removed while active. |
1009 ERROR_PLAY_RUNTIME_ERROR, // Errors in voice processing. | 1020 ERROR_PLAY_RUNTIME_ERROR, // Errors in voice processing. |
1010 ERROR_PLAY_SRTP_ERROR, // Generic SRTP failure. | 1021 ERROR_PLAY_SRTP_ERROR, // Generic SRTP failure. |
1011 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 1022 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
1012 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. | 1023 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. |
1013 }; | 1024 }; |
1014 | 1025 |
1015 VoiceMediaChannel() {} | 1026 VoiceMediaChannel() {} |
1016 virtual ~VoiceMediaChannel() {} | 1027 virtual ~VoiceMediaChannel() {} |
1028 // TODO(pthatcher): Remove SetSendCodecs, | |
1029 // SetSendRtpHeaderExtensions, SetMaxSendBandwidth, and SetOptions | |
1030 // once all implementations implement SetSendParameters. | |
1031 virtual bool SetSendParameters(const AudioSendParameters& params) { | |
1032 return (SetSendCodecs(params.codecs) && | |
1033 SetSendRtpHeaderExtensions(params.extensions) && | |
1034 SetMaxSendBandwidth(params.max_bandwidth_bps) && | |
1035 SetOptions(params.options)); | |
1036 } | |
1037 // TODO(pthatcher): Remove SetRecvCodecs and | |
1038 // SetRecvRtpHeaderExtensions once all implementations implement | |
1039 // SetRecvParameters. | |
1040 virtual bool SetRecvParameters(const AudioRecvParameters& params) { | |
1041 return (SetRecvCodecs(params.codecs) && | |
1042 SetRecvRtpHeaderExtensions(params.extensions)); | |
1043 } | |
1017 // Sets the codecs/payload types to be used for incoming media. | 1044 // Sets the codecs/payload types to be used for incoming media. |
1018 virtual bool SetRecvCodecs(const std::vector<AudioCodec>& codecs) = 0; | 1045 virtual bool SetRecvCodecs(const std::vector<AudioCodec>& codecs) = 0; |
1019 // Sets the codecs/payload types to be used for outgoing media. | 1046 // Sets the codecs/payload types to be used for outgoing media. |
1020 virtual bool SetSendCodecs(const std::vector<AudioCodec>& codecs) = 0; | 1047 virtual bool SetSendCodecs(const std::vector<AudioCodec>& codecs) = 0; |
1021 // Starts or stops playout of received audio. | 1048 // Starts or stops playout of received audio. |
1022 virtual bool SetPlayout(bool playout) = 0; | 1049 virtual bool SetPlayout(bool playout) = 0; |
1023 // Starts or stops sending (and potentially capture) of local audio. | 1050 // Starts or stops sending (and potentially capture) of local audio. |
1024 virtual bool SetSend(SendFlags flag) = 0; | 1051 virtual bool SetSend(SendFlags flag) = 0; |
1025 // Sets the renderer object to be used for the specified remote audio stream. | 1052 // Sets the renderer object to be used for the specified remote audio stream. |
1026 virtual bool SetRemoteRenderer(uint32 ssrc, AudioRenderer* renderer) = 0; | 1053 virtual bool SetRemoteRenderer(uint32 ssrc, AudioRenderer* renderer) = 0; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1062 } | 1089 } |
1063 // Sets the media options to use. | 1090 // Sets the media options to use. |
1064 virtual bool SetOptions(const AudioOptions& options) = 0; | 1091 virtual bool SetOptions(const AudioOptions& options) = 0; |
1065 virtual bool GetOptions(AudioOptions* options) const = 0; | 1092 virtual bool GetOptions(AudioOptions* options) const = 0; |
1066 | 1093 |
1067 // Signal errors from MediaChannel. Arguments are: | 1094 // Signal errors from MediaChannel. Arguments are: |
1068 // ssrc(uint32), and error(VoiceMediaChannel::Error). | 1095 // ssrc(uint32), and error(VoiceMediaChannel::Error). |
1069 sigslot::signal2<uint32, VoiceMediaChannel::Error> SignalMediaError; | 1096 sigslot::signal2<uint32, VoiceMediaChannel::Error> SignalMediaError; |
1070 }; | 1097 }; |
1071 | 1098 |
1099 struct VideoSendParameters { | |
1100 std::vector<VideoCodec> codecs; | |
1101 std::vector<RtpHeaderExtension> extensions; | |
1102 // TODO(pthatcher): Move max_bandwidth_bps into VideoOptions. | |
1103 int max_bandwidth_bps; | |
1104 VideoOptions options; | |
1105 // TODO(pthatcher): Add "remote" streams. | |
1106 }; | |
1107 | |
1108 struct VideoRecvParameters { | |
1109 std::vector<VideoCodec> codecs; | |
1110 std::vector<RtpHeaderExtension> extensions; | |
1111 // TODO(pthatcher): Add "local" streams. | |
1112 }; | |
1113 | |
1072 class VideoMediaChannel : public MediaChannel { | 1114 class VideoMediaChannel : public MediaChannel { |
1073 public: | 1115 public: |
1074 enum Error { | 1116 enum Error { |
1075 ERROR_NONE = 0, // No error. | 1117 ERROR_NONE = 0, // No error. |
1076 ERROR_OTHER, // Other errors. | 1118 ERROR_OTHER, // Other errors. |
1077 ERROR_REC_DEVICE_OPEN_FAILED = 100, // Could not open camera. | 1119 ERROR_REC_DEVICE_OPEN_FAILED = 100, // Could not open camera. |
1078 ERROR_REC_DEVICE_NO_DEVICE, // No camera. | 1120 ERROR_REC_DEVICE_NO_DEVICE, // No camera. |
1079 ERROR_REC_DEVICE_IN_USE, // Device is in already use. | 1121 ERROR_REC_DEVICE_IN_USE, // Device is in already use. |
1080 ERROR_REC_DEVICE_REMOVED, // Device is removed. | 1122 ERROR_REC_DEVICE_REMOVED, // Device is removed. |
1081 ERROR_REC_SRTP_ERROR, // Generic sender SRTP failure. | 1123 ERROR_REC_SRTP_ERROR, // Generic sender SRTP failure. |
1082 ERROR_REC_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 1124 ERROR_REC_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
1083 ERROR_REC_CPU_MAX_CANT_DOWNGRADE, // Can't downgrade capture anymore. | 1125 ERROR_REC_CPU_MAX_CANT_DOWNGRADE, // Can't downgrade capture anymore. |
1084 ERROR_PLAY_SRTP_ERROR = 200, // Generic receiver SRTP failure. | 1126 ERROR_PLAY_SRTP_ERROR = 200, // Generic receiver SRTP failure. |
1085 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 1127 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
1086 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. | 1128 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. |
1087 }; | 1129 }; |
1088 | 1130 |
1089 VideoMediaChannel() : renderer_(NULL) {} | 1131 VideoMediaChannel() : renderer_(NULL) {} |
1090 virtual ~VideoMediaChannel() {} | 1132 virtual ~VideoMediaChannel() {} |
1091 // Allow video channel to unhook itself from an associated voice channel. | 1133 // Allow video channel to unhook itself from an associated voice channel. |
1092 virtual void DetachVoiceChannel() = 0; | 1134 virtual void DetachVoiceChannel() = 0; |
1135 // TODO(pthatcher): Remove SetSendCodecs, | |
1136 // SetSendRtpHeaderExtensions, SetMaxSendBandwidth, and SetOptions | |
1137 // once all implementations implement SetSendParameters. | |
1138 virtual bool SetSendParameters(const VideoSendParameters& params) { | |
1139 return (SetSendCodecs(params.codecs) && | |
1140 SetSendRtpHeaderExtensions(params.extensions) && | |
1141 SetMaxSendBandwidth(params.max_bandwidth_bps) && | |
1142 SetOptions(params.options)); | |
1143 } | |
1144 // TODO(pthatcher): Remove SetRecvCodecs and | |
1145 // SetRecvRtpHeaderExtensions once all implementations implement | |
1146 // SetRecvParameters. | |
1147 virtual bool SetRecvParameters(const VideoRecvParameters& params) { | |
1148 return (SetRecvCodecs(params.codecs) && | |
1149 SetRecvRtpHeaderExtensions(params.extensions)); | |
1150 } | |
1093 // Sets the codecs/payload types to be used for incoming media. | 1151 // Sets the codecs/payload types to be used for incoming media. |
1094 virtual bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) = 0; | 1152 virtual bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) = 0; |
1095 // Sets the codecs/payload types to be used for outgoing media. | 1153 // Sets the codecs/payload types to be used for outgoing media. |
1096 virtual bool SetSendCodecs(const std::vector<VideoCodec>& codecs) = 0; | 1154 virtual bool SetSendCodecs(const std::vector<VideoCodec>& codecs) = 0; |
1097 // Gets the currently set codecs/payload types to be used for outgoing media. | 1155 // Gets the currently set codecs/payload types to be used for outgoing media. |
1098 virtual bool GetSendCodec(VideoCodec* send_codec) = 0; | 1156 virtual bool GetSendCodec(VideoCodec* send_codec) = 0; |
1099 // Sets the format of a specified outgoing stream. | 1157 // Sets the format of a specified outgoing stream. |
1100 virtual bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) = 0; | 1158 virtual bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) = 0; |
1101 // Starts or stops playout of received video. | 1159 // Starts or stops playout of received video. |
1102 virtual bool SetRender(bool render) = 0; | 1160 virtual bool SetRender(bool render) = 0; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1186 // TODO(pthatcher): Make these true by default? | 1244 // TODO(pthatcher): Make these true by default? |
1187 ordered(false), | 1245 ordered(false), |
1188 reliable(false), | 1246 reliable(false), |
1189 max_rtx_count(0), | 1247 max_rtx_count(0), |
1190 max_rtx_ms(0) { | 1248 max_rtx_ms(0) { |
1191 } | 1249 } |
1192 }; | 1250 }; |
1193 | 1251 |
1194 enum SendDataResult { SDR_SUCCESS, SDR_ERROR, SDR_BLOCK }; | 1252 enum SendDataResult { SDR_SUCCESS, SDR_ERROR, SDR_BLOCK }; |
1195 | 1253 |
1254 struct DataSendParameters { | |
1255 std::vector<DataCodec> codecs; | |
1256 // TODO(pthatcher): Move max_bandwidth_bps into DataOptions. | |
1257 int max_bandwidth_bps; | |
1258 // TODO(pthatcher): Add "remote" streams. | |
1259 }; | |
1260 | |
1261 struct DataRecvParameters { | |
1262 std::vector<DataCodec> codecs; | |
1263 // TODO(pthatcher): Add "local" streams. | |
1264 }; | |
1265 | |
1196 class DataMediaChannel : public MediaChannel { | 1266 class DataMediaChannel : public MediaChannel { |
1197 public: | 1267 public: |
1198 enum Error { | 1268 enum Error { |
1199 ERROR_NONE = 0, // No error. | 1269 ERROR_NONE = 0, // No error. |
1200 ERROR_OTHER, // Other errors. | 1270 ERROR_OTHER, // Other errors. |
1201 ERROR_SEND_SRTP_ERROR = 200, // Generic SRTP failure. | 1271 ERROR_SEND_SRTP_ERROR = 200, // Generic SRTP failure. |
1202 ERROR_SEND_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 1272 ERROR_SEND_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
1203 ERROR_RECV_SRTP_ERROR, // Generic SRTP failure. | 1273 ERROR_RECV_SRTP_ERROR, // Generic SRTP failure. |
1204 ERROR_RECV_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 1274 ERROR_RECV_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
1205 ERROR_RECV_SRTP_REPLAY, // Packet replay detected. | 1275 ERROR_RECV_SRTP_REPLAY, // Packet replay detected. |
1206 }; | 1276 }; |
1207 | 1277 |
1208 virtual ~DataMediaChannel() {} | 1278 virtual ~DataMediaChannel() {} |
1209 | 1279 |
1280 // TODO(pthatcher): Remove SetSendCodecs, | |
1281 // SetSendRtpHeaderExtensions, SetMaxSendBandwidth, and SetOptions | |
1282 // once all implementations implement SetSendParameters. | |
1283 virtual bool SetSendParameters(const DataSendParameters& params) { | |
1284 return (SetSendCodecs(params.codecs) && | |
1285 SetMaxSendBandwidth(params.max_bandwidth_bps)); | |
1286 } | |
1287 // TODO(pthatcher): Remove SetRecvCodecs and | |
1288 // SetRecvRtpHeaderExtensions once all implementations implement | |
1289 // SetRecvParameters. | |
1290 virtual bool SetRecvParameters(const DataRecvParameters& params) { | |
1291 return SetRecvCodecs(params.codecs); | |
1292 } | |
1210 virtual bool SetSendCodecs(const std::vector<DataCodec>& codecs) = 0; | 1293 virtual bool SetSendCodecs(const std::vector<DataCodec>& codecs) = 0; |
1211 virtual bool SetRecvCodecs(const std::vector<DataCodec>& codecs) = 0; | 1294 virtual bool SetRecvCodecs(const std::vector<DataCodec>& codecs) = 0; |
1212 | 1295 |
1213 virtual bool MuteStream(uint32 ssrc, bool on) { return false; } | 1296 virtual bool MuteStream(uint32 ssrc, bool on) { return false; } |
1214 // TODO(pthatcher): Implement this. | 1297 // TODO(pthatcher): Implement this. |
1215 virtual bool GetStats(DataMediaInfo* info) { return true; } | 1298 virtual bool GetStats(DataMediaInfo* info) { return true; } |
1216 | 1299 |
1217 virtual bool SetSend(bool send) = 0; | 1300 virtual bool SetSend(bool send) = 0; |
1218 virtual bool SetReceive(bool receive) = 0; | 1301 virtual bool SetReceive(bool receive) = 0; |
1219 | 1302 |
(...skipping 11 matching lines...) Expand all Loading... | |
1231 // Signal when the media channel is ready to send the stream. Arguments are: | 1314 // Signal when the media channel is ready to send the stream. Arguments are: |
1232 // writable(bool) | 1315 // writable(bool) |
1233 sigslot::signal1<bool> SignalReadyToSend; | 1316 sigslot::signal1<bool> SignalReadyToSend; |
1234 // Signal for notifying that the remote side has closed the DataChannel. | 1317 // Signal for notifying that the remote side has closed the DataChannel. |
1235 sigslot::signal1<uint32> SignalStreamClosedRemotely; | 1318 sigslot::signal1<uint32> SignalStreamClosedRemotely; |
1236 }; | 1319 }; |
1237 | 1320 |
1238 } // namespace cricket | 1321 } // namespace cricket |
1239 | 1322 |
1240 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ | 1323 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ |
OLD | NEW |