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 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 DMT_CONTROL = 1, | 1070 DMT_CONTROL = 1, |
1071 DMT_BINARY = 2, | 1071 DMT_BINARY = 2, |
1072 DMT_TEXT = 3, | 1072 DMT_TEXT = 3, |
1073 }; | 1073 }; |
1074 | 1074 |
1075 // Info about data received in DataMediaChannel. For use in | 1075 // Info about data received in DataMediaChannel. For use in |
1076 // DataMediaChannel::SignalDataReceived and in all of the signals that | 1076 // DataMediaChannel::SignalDataReceived and in all of the signals that |
1077 // signal fires, on up the chain. | 1077 // signal fires, on up the chain. |
1078 struct ReceiveDataParams { | 1078 struct ReceiveDataParams { |
1079 // The in-packet stream indentifier. | 1079 // The in-packet stream indentifier. |
1080 // RTP data channels use SSRCs, SCTP data channels use SIDs. | 1080 // For SCTP, this is really SID, not SSRC. |
1081 union { | 1081 uint32_t ssrc; |
1082 uint32_t ssrc; | |
1083 int sid; | |
1084 }; | |
1085 // The type of message (binary, text, or control). | 1082 // The type of message (binary, text, or control). |
1086 DataMessageType type; | 1083 DataMessageType type; |
1087 // A per-stream value incremented per packet in the stream. | 1084 // A per-stream value incremented per packet in the stream. |
1088 int seq_num; | 1085 int seq_num; |
1089 // A per-stream value monotonically increasing with time. | 1086 // A per-stream value monotonically increasing with time. |
1090 int timestamp; | 1087 int timestamp; |
1091 | 1088 |
1092 ReceiveDataParams() : sid(0), type(DMT_TEXT), seq_num(0), timestamp(0) {} | 1089 ReceiveDataParams() : |
| 1090 ssrc(0), |
| 1091 type(DMT_TEXT), |
| 1092 seq_num(0), |
| 1093 timestamp(0) { |
| 1094 } |
1093 }; | 1095 }; |
1094 | 1096 |
1095 struct SendDataParams { | 1097 struct SendDataParams { |
1096 // The in-packet stream indentifier. | 1098 // The in-packet stream indentifier. |
1097 // RTP data channels use SSRCs, SCTP data channels use SIDs. | 1099 // For SCTP, this is really SID, not SSRC. |
1098 union { | 1100 uint32_t ssrc; |
1099 uint32_t ssrc; | |
1100 int sid; | |
1101 }; | |
1102 // The type of message (binary, text, or control). | 1101 // The type of message (binary, text, or control). |
1103 DataMessageType type; | 1102 DataMessageType type; |
1104 | 1103 |
1105 // For SCTP, whether to send messages flagged as ordered or not. | 1104 // For SCTP, whether to send messages flagged as ordered or not. |
1106 // If false, messages can be received out of order. | 1105 // If false, messages can be received out of order. |
1107 bool ordered; | 1106 bool ordered; |
1108 // For SCTP, whether the messages are sent reliably or not. | 1107 // For SCTP, whether the messages are sent reliably or not. |
1109 // If false, messages may be lost. | 1108 // If false, messages may be lost. |
1110 bool reliable; | 1109 bool reliable; |
1111 // For SCTP, if reliable == false, provide partial reliability by | 1110 // For SCTP, if reliable == false, provide partial reliability by |
1112 // resending up to this many times. Either count or millis | 1111 // resending up to this many times. Either count or millis |
1113 // is supported, not both at the same time. | 1112 // is supported, not both at the same time. |
1114 int max_rtx_count; | 1113 int max_rtx_count; |
1115 // For SCTP, if reliable == false, provide partial reliability by | 1114 // For SCTP, if reliable == false, provide partial reliability by |
1116 // resending for up to this many milliseconds. Either count or millis | 1115 // resending for up to this many milliseconds. Either count or millis |
1117 // is supported, not both at the same time. | 1116 // is supported, not both at the same time. |
1118 int max_rtx_ms; | 1117 int max_rtx_ms; |
1119 | 1118 |
1120 SendDataParams() | 1119 SendDataParams() : |
1121 : sid(0), | 1120 ssrc(0), |
1122 type(DMT_TEXT), | 1121 type(DMT_TEXT), |
1123 // TODO(pthatcher): Make these true by default? | 1122 // TODO(pthatcher): Make these true by default? |
1124 ordered(false), | 1123 ordered(false), |
1125 reliable(false), | 1124 reliable(false), |
1126 max_rtx_count(0), | 1125 max_rtx_count(0), |
1127 max_rtx_ms(0) {} | 1126 max_rtx_ms(0) { |
| 1127 } |
1128 }; | 1128 }; |
1129 | 1129 |
1130 enum SendDataResult { SDR_SUCCESS, SDR_ERROR, SDR_BLOCK }; | 1130 enum SendDataResult { SDR_SUCCESS, SDR_ERROR, SDR_BLOCK }; |
1131 | 1131 |
1132 struct DataSendParameters : RtpSendParameters<DataCodec> { | 1132 struct DataSendParameters : RtpSendParameters<DataCodec> { |
1133 std::string ToString() const { | 1133 std::string ToString() const { |
1134 std::ostringstream ost; | 1134 std::ostringstream ost; |
1135 // Options and extensions aren't used. | 1135 // Options and extensions aren't used. |
1136 ost << "{"; | 1136 ost << "{"; |
1137 ost << "codecs: " << VectorToString(codecs) << ", "; | 1137 ost << "codecs: " << VectorToString(codecs) << ", "; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 const SendDataParams& params, | 1176 const SendDataParams& params, |
1177 const rtc::CopyOnWriteBuffer& payload, | 1177 const rtc::CopyOnWriteBuffer& payload, |
1178 SendDataResult* result = NULL) = 0; | 1178 SendDataResult* result = NULL) = 0; |
1179 // Signals when data is received (params, data, len) | 1179 // Signals when data is received (params, data, len) |
1180 sigslot::signal3<const ReceiveDataParams&, | 1180 sigslot::signal3<const ReceiveDataParams&, |
1181 const char*, | 1181 const char*, |
1182 size_t> SignalDataReceived; | 1182 size_t> SignalDataReceived; |
1183 // Signal when the media channel is ready to send the stream. Arguments are: | 1183 // Signal when the media channel is ready to send the stream. Arguments are: |
1184 // writable(bool) | 1184 // writable(bool) |
1185 sigslot::signal1<bool> SignalReadyToSend; | 1185 sigslot::signal1<bool> SignalReadyToSend; |
| 1186 // Signal for notifying that the remote side has closed the DataChannel. |
| 1187 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; |
1186 }; | 1188 }; |
1187 | 1189 |
1188 } // namespace cricket | 1190 } // namespace cricket |
1189 | 1191 |
1190 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ | 1192 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ |
OLD | NEW |