| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 if (i > 0) { | 74 if (i > 0) { |
| 75 ost << ", "; | 75 ost << ", "; |
| 76 } | 76 } |
| 77 ost << vals[i].ToString(); | 77 ost << vals[i].ToString(); |
| 78 } | 78 } |
| 79 ost << "]"; | 79 ost << "]"; |
| 80 return ost.str(); | 80 return ost.str(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 template <typename T> | 83 template <typename T> |
| 84 static T MinPositive(T a, T b) { | 84 static rtc::Optional<T> OptionalMin(rtc::Optional<T> a, rtc::Optional<T> b) { |
| 85 if (a <= 0) { | 85 if (!a) { |
| 86 return b; | 86 return b; |
| 87 } | 87 } |
| 88 if (b <= 0) { | 88 if (!b) { |
| 89 return a; | 89 return a; |
| 90 } | 90 } |
| 91 return std::min(a, b); | 91 |
| 92 return rtc::Optional<T>(std::min(*a, *b)); |
| 92 } | 93 } |
| 93 | 94 |
| 94 // Construction-time settings, passed to | 95 // Construction-time settings, passed to |
| 95 // MediaControllerInterface::Create, and passed on when creating | 96 // MediaControllerInterface::Create, and passed on when creating |
| 96 // MediaChannels. | 97 // MediaChannels. |
| 97 struct MediaConfig { | 98 struct MediaConfig { |
| 98 // Set DSCP value on packets. This flag comes from the | 99 // Set DSCP value on packets. This flag comes from the |
| 99 // PeerConnection constraint 'googDscp'. | 100 // PeerConnection constraint 'googDscp'. |
| 100 bool enable_dscp = false; | 101 bool enable_dscp = false; |
| 101 | 102 |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 RtcpParameters rtcp; | 838 RtcpParameters rtcp; |
| 838 }; | 839 }; |
| 839 | 840 |
| 840 template <class Codec> | 841 template <class Codec> |
| 841 struct RtpSendParameters : RtpParameters<Codec> { | 842 struct RtpSendParameters : RtpParameters<Codec> { |
| 842 std::string ToString() const override { | 843 std::string ToString() const override { |
| 843 std::ostringstream ost; | 844 std::ostringstream ost; |
| 844 ost << "{"; | 845 ost << "{"; |
| 845 ost << "codecs: " << VectorToString(this->codecs) << ", "; | 846 ost << "codecs: " << VectorToString(this->codecs) << ", "; |
| 846 ost << "extensions: " << VectorToString(this->extensions) << ", "; | 847 ost << "extensions: " << VectorToString(this->extensions) << ", "; |
| 847 ost << "max_bandwidth_bps: " << max_bandwidth_bps << ", "; | 848 ost << "max_bitrate_bps: " << max_bitrate_bps << ", "; |
| 848 ost << "}"; | 849 ost << "}"; |
| 849 return ost.str(); | 850 return ost.str(); |
| 850 } | 851 } |
| 851 | 852 |
| 852 int max_bandwidth_bps = -1; | 853 rtc::Optional<int> max_bitrate_bps; |
| 853 }; | 854 }; |
| 854 | 855 |
| 855 struct AudioSendParameters : RtpSendParameters<AudioCodec> { | 856 struct AudioSendParameters : RtpSendParameters<AudioCodec> { |
| 856 std::string ToString() const override { | 857 std::string ToString() const override { |
| 857 std::ostringstream ost; | 858 std::ostringstream ost; |
| 858 ost << "{"; | 859 ost << "{"; |
| 859 ost << "codecs: " << VectorToString(this->codecs) << ", "; | 860 ost << "codecs: " << VectorToString(this->codecs) << ", "; |
| 860 ost << "extensions: " << VectorToString(this->extensions) << ", "; | 861 ost << "extensions: " << VectorToString(this->extensions) << ", "; |
| 861 ost << "max_bandwidth_bps: " << max_bandwidth_bps << ", "; | 862 ost << "max_bitrate_bps: " << max_bitrate_bps << ", "; |
| 862 ost << "options: " << options.ToString(); | 863 ost << "options: " << options.ToString(); |
| 863 ost << "}"; | 864 ost << "}"; |
| 864 return ost.str(); | 865 return ost.str(); |
| 865 } | 866 } |
| 866 | 867 |
| 867 AudioOptions options; | 868 AudioOptions options; |
| 868 }; | 869 }; |
| 869 | 870 |
| 870 struct AudioRecvParameters : RtpParameters<AudioCodec> { | 871 struct AudioRecvParameters : RtpParameters<AudioCodec> { |
| 871 }; | 872 }; |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 }; | 1058 }; |
| 1058 | 1059 |
| 1059 enum SendDataResult { SDR_SUCCESS, SDR_ERROR, SDR_BLOCK }; | 1060 enum SendDataResult { SDR_SUCCESS, SDR_ERROR, SDR_BLOCK }; |
| 1060 | 1061 |
| 1061 struct DataSendParameters : RtpSendParameters<DataCodec> { | 1062 struct DataSendParameters : RtpSendParameters<DataCodec> { |
| 1062 std::string ToString() const { | 1063 std::string ToString() const { |
| 1063 std::ostringstream ost; | 1064 std::ostringstream ost; |
| 1064 // Options and extensions aren't used. | 1065 // Options and extensions aren't used. |
| 1065 ost << "{"; | 1066 ost << "{"; |
| 1066 ost << "codecs: " << VectorToString(codecs) << ", "; | 1067 ost << "codecs: " << VectorToString(codecs) << ", "; |
| 1067 ost << "max_bandwidth_bps: " << max_bandwidth_bps; | 1068 ost << "max_bitrate_bps: " << max_bitrate_bps; |
| 1068 ost << "}"; | 1069 ost << "}"; |
| 1069 return ost.str(); | 1070 return ost.str(); |
| 1070 } | 1071 } |
| 1071 }; | 1072 }; |
| 1072 | 1073 |
| 1073 struct DataRecvParameters : RtpParameters<DataCodec> { | 1074 struct DataRecvParameters : RtpParameters<DataCodec> { |
| 1074 }; | 1075 }; |
| 1075 | 1076 |
| 1076 class DataMediaChannel : public MediaChannel { | 1077 class DataMediaChannel : public MediaChannel { |
| 1077 public: | 1078 public: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1107 // Signal when the media channel is ready to send the stream. Arguments are: | 1108 // Signal when the media channel is ready to send the stream. Arguments are: |
| 1108 // writable(bool) | 1109 // writable(bool) |
| 1109 sigslot::signal1<bool> SignalReadyToSend; | 1110 sigslot::signal1<bool> SignalReadyToSend; |
| 1110 // Signal for notifying that the remote side has closed the DataChannel. | 1111 // Signal for notifying that the remote side has closed the DataChannel. |
| 1111 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; | 1112 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; |
| 1112 }; | 1113 }; |
| 1113 | 1114 |
| 1114 } // namespace cricket | 1115 } // namespace cricket |
| 1115 | 1116 |
| 1116 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ | 1117 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ |
| OLD | NEW |