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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 if (i > 0) { | 75 if (i > 0) { |
76 ost << ", "; | 76 ost << ", "; |
77 } | 77 } |
78 ost << vals[i].ToString(); | 78 ost << vals[i].ToString(); |
79 } | 79 } |
80 ost << "]"; | 80 ost << "]"; |
81 return ost.str(); | 81 return ost.str(); |
82 } | 82 } |
83 | 83 |
84 template <typename T> | 84 template <typename T> |
85 static T MinPositive(T a, T b) { | 85 static rtc::Optional<T> OptionalMin(rtc::Optional<T> a, rtc::Optional<T> b) { |
86 if (a <= 0) { | 86 if (!a) { |
87 return b; | 87 return b; |
88 } | 88 } |
89 if (b <= 0) { | 89 if (!b) { |
90 return a; | 90 return a; |
91 } | 91 } |
92 return std::min(a, b); | 92 |
| 93 return rtc::Optional<T>(std::min(*a, *b)); |
93 } | 94 } |
94 | 95 |
95 // Construction-time settings, passed to | 96 // Construction-time settings, passed to |
96 // MediaControllerInterface::Create, and passed on when creating | 97 // MediaControllerInterface::Create, and passed on when creating |
97 // MediaChannels. | 98 // MediaChannels. |
98 struct MediaConfig { | 99 struct MediaConfig { |
99 // Set DSCP value on packets. This flag comes from the | 100 // Set DSCP value on packets. This flag comes from the |
100 // PeerConnection constraint 'googDscp'. | 101 // PeerConnection constraint 'googDscp'. |
101 bool enable_dscp = false; | 102 bool enable_dscp = false; |
102 | 103 |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 | 846 |
846 // TODO(deadbeef): Rename to RtpSenderParameters, since they're intended to | 847 // TODO(deadbeef): Rename to RtpSenderParameters, since they're intended to |
847 // encapsulate all the parameters needed for an RtpSender. | 848 // encapsulate all the parameters needed for an RtpSender. |
848 template <class Codec> | 849 template <class Codec> |
849 struct RtpSendParameters : RtpParameters<Codec> { | 850 struct RtpSendParameters : RtpParameters<Codec> { |
850 std::string ToString() const override { | 851 std::string ToString() const override { |
851 std::ostringstream ost; | 852 std::ostringstream ost; |
852 ost << "{"; | 853 ost << "{"; |
853 ost << "codecs: " << VectorToString(this->codecs) << ", "; | 854 ost << "codecs: " << VectorToString(this->codecs) << ", "; |
854 ost << "extensions: " << VectorToString(this->extensions) << ", "; | 855 ost << "extensions: " << VectorToString(this->extensions) << ", "; |
855 ost << "max_bandwidth_bps: " << max_bandwidth_bps << ", "; | 856 ost << "max_bitrate_bps: " << max_bitrate_bps << ", "; |
856 ost << "}"; | 857 ost << "}"; |
857 return ost.str(); | 858 return ost.str(); |
858 } | 859 } |
859 | 860 |
860 int max_bandwidth_bps = -1; | 861 rtc::Optional<int> max_bitrate_bps; |
861 }; | 862 }; |
862 | 863 |
863 struct AudioSendParameters : RtpSendParameters<AudioCodec> { | 864 struct AudioSendParameters : RtpSendParameters<AudioCodec> { |
864 std::string ToString() const override { | 865 std::string ToString() const override { |
865 std::ostringstream ost; | 866 std::ostringstream ost; |
866 ost << "{"; | 867 ost << "{"; |
867 ost << "codecs: " << VectorToString(this->codecs) << ", "; | 868 ost << "codecs: " << VectorToString(this->codecs) << ", "; |
868 ost << "extensions: " << VectorToString(this->extensions) << ", "; | 869 ost << "extensions: " << VectorToString(this->extensions) << ", "; |
869 ost << "max_bandwidth_bps: " << max_bandwidth_bps << ", "; | 870 ost << "max_bitrate_bps: " << max_bitrate_bps << ", "; |
870 ost << "options: " << options.ToString(); | 871 ost << "options: " << options.ToString(); |
871 ost << "}"; | 872 ost << "}"; |
872 return ost.str(); | 873 return ost.str(); |
873 } | 874 } |
874 | 875 |
875 AudioOptions options; | 876 AudioOptions options; |
876 }; | 877 }; |
877 | 878 |
878 struct AudioRecvParameters : RtpParameters<AudioCodec> { | 879 struct AudioRecvParameters : RtpParameters<AudioCodec> { |
879 }; | 880 }; |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 }; | 1070 }; |
1070 | 1071 |
1071 enum SendDataResult { SDR_SUCCESS, SDR_ERROR, SDR_BLOCK }; | 1072 enum SendDataResult { SDR_SUCCESS, SDR_ERROR, SDR_BLOCK }; |
1072 | 1073 |
1073 struct DataSendParameters : RtpSendParameters<DataCodec> { | 1074 struct DataSendParameters : RtpSendParameters<DataCodec> { |
1074 std::string ToString() const { | 1075 std::string ToString() const { |
1075 std::ostringstream ost; | 1076 std::ostringstream ost; |
1076 // Options and extensions aren't used. | 1077 // Options and extensions aren't used. |
1077 ost << "{"; | 1078 ost << "{"; |
1078 ost << "codecs: " << VectorToString(codecs) << ", "; | 1079 ost << "codecs: " << VectorToString(codecs) << ", "; |
1079 ost << "max_bandwidth_bps: " << max_bandwidth_bps; | 1080 ost << "max_bitrate_bps: " << max_bitrate_bps; |
1080 ost << "}"; | 1081 ost << "}"; |
1081 return ost.str(); | 1082 return ost.str(); |
1082 } | 1083 } |
1083 }; | 1084 }; |
1084 | 1085 |
1085 struct DataRecvParameters : RtpParameters<DataCodec> { | 1086 struct DataRecvParameters : RtpParameters<DataCodec> { |
1086 }; | 1087 }; |
1087 | 1088 |
1088 class DataMediaChannel : public MediaChannel { | 1089 class DataMediaChannel : public MediaChannel { |
1089 public: | 1090 public: |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 // Signal when the media channel is ready to send the stream. Arguments are: | 1123 // Signal when the media channel is ready to send the stream. Arguments are: |
1123 // writable(bool) | 1124 // writable(bool) |
1124 sigslot::signal1<bool> SignalReadyToSend; | 1125 sigslot::signal1<bool> SignalReadyToSend; |
1125 // Signal for notifying that the remote side has closed the DataChannel. | 1126 // Signal for notifying that the remote side has closed the DataChannel. |
1126 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; | 1127 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; |
1127 }; | 1128 }; |
1128 | 1129 |
1129 } // namespace cricket | 1130 } // namespace cricket |
1130 | 1131 |
1131 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ | 1132 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ |
OLD | NEW |