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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 // multiple SSRCs. | 559 // multiple SSRCs. |
560 virtual bool RemoveSendStream(uint32 ssrc) = 0; | 560 virtual bool RemoveSendStream(uint32 ssrc) = 0; |
561 // Creates a new incoming media stream with SSRCs and CNAME as described | 561 // Creates a new incoming media stream with SSRCs and CNAME as described |
562 // by sp. | 562 // by sp. |
563 virtual bool AddRecvStream(const StreamParams& sp) = 0; | 563 virtual bool AddRecvStream(const StreamParams& sp) = 0; |
564 // Removes an incoming media stream. | 564 // Removes an incoming media stream. |
565 // ssrc must be the first SSRC of the media stream if the stream uses | 565 // ssrc must be the first SSRC of the media stream if the stream uses |
566 // multiple SSRCs. | 566 // multiple SSRCs. |
567 virtual bool RemoveRecvStream(uint32 ssrc) = 0; | 567 virtual bool RemoveRecvStream(uint32 ssrc) = 0; |
568 | 568 |
569 // Mutes the channel. | |
570 virtual bool MuteStream(uint32 ssrc, bool on) = 0; | |
571 | |
572 // Sets the RTP extension headers and IDs to use when sending RTP. | |
573 virtual bool SetRecvRtpHeaderExtensions( | |
574 const std::vector<RtpHeaderExtension>& extensions) = 0; | |
575 virtual bool SetSendRtpHeaderExtensions( | |
576 const std::vector<RtpHeaderExtension>& extensions) = 0; | |
577 // Returns the absoulte sendtime extension id value from media channel. | 569 // Returns the absoulte sendtime extension id value from media channel. |
578 virtual int GetRtpSendTimeExtnId() const { | 570 virtual int GetRtpSendTimeExtnId() const { |
579 return -1; | 571 return -1; |
580 } | 572 } |
581 // Sets the maximum allowed bandwidth to use when sending data. | |
582 virtual bool SetMaxSendBandwidth(int bps) = 0; | |
583 | 573 |
584 // Base method to send packet using NetworkInterface. | 574 // Base method to send packet using NetworkInterface. |
585 bool SendPacket(rtc::Buffer* packet) { | 575 bool SendPacket(rtc::Buffer* packet) { |
586 return DoSendPacket(packet, false); | 576 return DoSendPacket(packet, false); |
587 } | 577 } |
588 | 578 |
589 bool SendRtcp(rtc::Buffer* packet) { | 579 bool SendRtcp(rtc::Buffer* packet) { |
590 return DoSendPacket(packet, true); | 580 return DoSendPacket(packet, true); |
591 } | 581 } |
592 | 582 |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 ERROR_PLAY_DEVICE_MUTED, // Playout muted by OS. | 1056 ERROR_PLAY_DEVICE_MUTED, // Playout muted by OS. |
1067 ERROR_PLAY_DEVICE_REMOVED, // Playout removed while active. | 1057 ERROR_PLAY_DEVICE_REMOVED, // Playout removed while active. |
1068 ERROR_PLAY_RUNTIME_ERROR, // Errors in voice processing. | 1058 ERROR_PLAY_RUNTIME_ERROR, // Errors in voice processing. |
1069 ERROR_PLAY_SRTP_ERROR, // Generic SRTP failure. | 1059 ERROR_PLAY_SRTP_ERROR, // Generic SRTP failure. |
1070 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 1060 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
1071 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. | 1061 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. |
1072 }; | 1062 }; |
1073 | 1063 |
1074 VoiceMediaChannel() {} | 1064 VoiceMediaChannel() {} |
1075 virtual ~VoiceMediaChannel() {} | 1065 virtual ~VoiceMediaChannel() {} |
1076 // TODO(pthatcher): Remove SetSendCodecs, | 1066 virtual bool SetSendParameters(const AudioSendParameters& params) = 0; |
1077 // SetSendRtpHeaderExtensions, SetMaxSendBandwidth, and SetOptions | 1067 virtual bool SetRecvParameters(const AudioRecvParameters& params) = 0; |
1078 // once all implementations implement SetSendParameters. | |
1079 virtual bool SetSendParameters(const AudioSendParameters& params) { | |
1080 return (SetSendCodecs(params.codecs) && | |
1081 SetSendRtpHeaderExtensions(params.extensions) && | |
1082 SetMaxSendBandwidth(params.max_bandwidth_bps) && | |
1083 SetOptions(params.options)); | |
1084 } | |
1085 // TODO(pthatcher): Remove SetRecvCodecs and | |
1086 // SetRecvRtpHeaderExtensions once all implementations implement | |
1087 // SetRecvParameters. | |
1088 virtual bool SetRecvParameters(const AudioRecvParameters& params) { | |
1089 return (SetRecvCodecs(params.codecs) && | |
1090 SetRecvRtpHeaderExtensions(params.extensions)); | |
1091 } | |
1092 // Sets the codecs/payload types to be used for incoming media. | |
1093 virtual bool SetRecvCodecs(const std::vector<AudioCodec>& codecs) = 0; | |
1094 // Sets the codecs/payload types to be used for outgoing media. | |
1095 virtual bool SetSendCodecs(const std::vector<AudioCodec>& codecs) = 0; | |
1096 // Starts or stops playout of received audio. | 1068 // Starts or stops playout of received audio. |
1097 virtual bool SetPlayout(bool playout) = 0; | 1069 virtual bool SetPlayout(bool playout) = 0; |
1098 // Starts or stops sending (and potentially capture) of local audio. | 1070 // Starts or stops sending (and potentially capture) of local audio. |
1099 virtual bool SetSend(SendFlags flag) = 0; | 1071 virtual bool SetSend(SendFlags flag) = 0; |
| 1072 // Mutes the channel. |
| 1073 virtual bool MuteStream(uint32 ssrc, bool on, |
| 1074 const AudioOptions* options) = 0; |
1100 // Sets the renderer object to be used for the specified remote audio stream. | 1075 // Sets the renderer object to be used for the specified remote audio stream. |
1101 virtual bool SetRemoteRenderer(uint32 ssrc, AudioRenderer* renderer) = 0; | 1076 virtual bool SetRemoteRenderer(uint32 ssrc, AudioRenderer* renderer) = 0; |
1102 // Sets the renderer object to be used for the specified local audio stream. | 1077 // Sets the renderer object to be used for the specified local audio stream. |
1103 virtual bool SetLocalRenderer(uint32 ssrc, AudioRenderer* renderer) = 0; | 1078 virtual bool SetLocalRenderer(uint32 ssrc, AudioRenderer* renderer) = 0; |
1104 // Gets current energy levels for all incoming streams. | 1079 // Gets current energy levels for all incoming streams. |
1105 virtual bool GetActiveStreams(AudioInfo::StreamList* actives) = 0; | 1080 virtual bool GetActiveStreams(AudioInfo::StreamList* actives) = 0; |
1106 // Get the current energy level of the stream sent to the speaker. | 1081 // Get the current energy level of the stream sent to the speaker. |
1107 virtual int GetOutputLevel() = 0; | 1082 virtual int GetOutputLevel() = 0; |
1108 // Get the time in milliseconds since last recorded keystroke, or negative. | 1083 // Get the time in milliseconds since last recorded keystroke, or negative. |
1109 virtual int GetTimeSinceLastTyping() = 0; | 1084 virtual int GetTimeSinceLastTyping() = 0; |
(...skipping 18 matching lines...) Expand all Loading... |
1128 // DTMF event 0-9, *, #, A-D. | 1103 // DTMF event 0-9, *, #, A-D. |
1129 virtual bool InsertDtmf(uint32 ssrc, int event, int duration, int flags) = 0; | 1104 virtual bool InsertDtmf(uint32 ssrc, int event, int duration, int flags) = 0; |
1130 // Gets quality stats for the channel. | 1105 // Gets quality stats for the channel. |
1131 virtual bool GetStats(VoiceMediaInfo* info) = 0; | 1106 virtual bool GetStats(VoiceMediaInfo* info) = 0; |
1132 // Gets last reported error for this media channel. | 1107 // Gets last reported error for this media channel. |
1133 virtual void GetLastMediaError(uint32* ssrc, | 1108 virtual void GetLastMediaError(uint32* ssrc, |
1134 VoiceMediaChannel::Error* error) { | 1109 VoiceMediaChannel::Error* error) { |
1135 ASSERT(error != NULL); | 1110 ASSERT(error != NULL); |
1136 *error = ERROR_NONE; | 1111 *error = ERROR_NONE; |
1137 } | 1112 } |
1138 // Sets the media options to use. | 1113 // Gets the media options to use. |
1139 virtual bool SetOptions(const AudioOptions& options) = 0; | |
1140 virtual bool GetOptions(AudioOptions* options) const = 0; | 1114 virtual bool GetOptions(AudioOptions* options) const = 0; |
1141 | 1115 |
1142 // Signal errors from MediaChannel. Arguments are: | 1116 // Signal errors from MediaChannel. Arguments are: |
1143 // ssrc(uint32), and error(VoiceMediaChannel::Error). | 1117 // ssrc(uint32), and error(VoiceMediaChannel::Error). |
1144 sigslot::signal2<uint32, VoiceMediaChannel::Error> SignalMediaError; | 1118 sigslot::signal2<uint32, VoiceMediaChannel::Error> SignalMediaError; |
1145 }; | 1119 }; |
1146 | 1120 |
1147 struct VideoSendParameters : RtpSendParameters<VideoCodec, VideoOptions> { | 1121 struct VideoSendParameters : RtpSendParameters<VideoCodec, VideoOptions> { |
1148 }; | 1122 }; |
1149 | 1123 |
(...skipping 14 matching lines...) Expand all Loading... |
1164 ERROR_REC_CPU_MAX_CANT_DOWNGRADE, // Can't downgrade capture anymore. | 1138 ERROR_REC_CPU_MAX_CANT_DOWNGRADE, // Can't downgrade capture anymore. |
1165 ERROR_PLAY_SRTP_ERROR = 200, // Generic receiver SRTP failure. | 1139 ERROR_PLAY_SRTP_ERROR = 200, // Generic receiver SRTP failure. |
1166 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 1140 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
1167 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. | 1141 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. |
1168 }; | 1142 }; |
1169 | 1143 |
1170 VideoMediaChannel() : renderer_(NULL) {} | 1144 VideoMediaChannel() : renderer_(NULL) {} |
1171 virtual ~VideoMediaChannel() {} | 1145 virtual ~VideoMediaChannel() {} |
1172 // Allow video channel to unhook itself from an associated voice channel. | 1146 // Allow video channel to unhook itself from an associated voice channel. |
1173 virtual void DetachVoiceChannel() = 0; | 1147 virtual void DetachVoiceChannel() = 0; |
1174 // TODO(pthatcher): Remove SetSendCodecs, | 1148 virtual bool SetSendParameters(const VideoSendParameters& params) = 0; |
1175 // SetSendRtpHeaderExtensions, SetMaxSendBandwidth, and SetOptions | 1149 virtual bool SetRecvParameters(const VideoRecvParameters& params) = 0; |
1176 // once all implementations implement SetSendParameters. | |
1177 virtual bool SetSendParameters(const VideoSendParameters& params) { | |
1178 return (SetSendCodecs(params.codecs) && | |
1179 SetSendRtpHeaderExtensions(params.extensions) && | |
1180 SetMaxSendBandwidth(params.max_bandwidth_bps) && | |
1181 SetOptions(params.options)); | |
1182 } | |
1183 // TODO(pthatcher): Remove SetRecvCodecs and | |
1184 // SetRecvRtpHeaderExtensions once all implementations implement | |
1185 // SetRecvParameters. | |
1186 virtual bool SetRecvParameters(const VideoRecvParameters& params) { | |
1187 return (SetRecvCodecs(params.codecs) && | |
1188 SetRecvRtpHeaderExtensions(params.extensions)); | |
1189 } | |
1190 // Sets the codecs/payload types to be used for incoming media. | |
1191 virtual bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) = 0; | |
1192 // Sets the codecs/payload types to be used for outgoing media. | |
1193 virtual bool SetSendCodecs(const std::vector<VideoCodec>& codecs) = 0; | |
1194 // Gets the currently set codecs/payload types to be used for outgoing media. | 1150 // Gets the currently set codecs/payload types to be used for outgoing media. |
1195 virtual bool GetSendCodec(VideoCodec* send_codec) = 0; | 1151 virtual bool GetSendCodec(VideoCodec* send_codec) = 0; |
1196 // Sets the format of a specified outgoing stream. | 1152 // Sets the format of a specified outgoing stream. |
1197 virtual bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) = 0; | 1153 virtual bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) = 0; |
1198 // Starts or stops playout of received video. | 1154 // Starts or stops playout of received video. |
1199 virtual bool SetRender(bool render) = 0; | 1155 virtual bool SetRender(bool render) = 0; |
1200 // Starts or stops transmission (and potentially capture) of local video. | 1156 // Starts or stops transmission (and potentially capture) of local video. |
1201 virtual bool SetSend(bool send) = 0; | 1157 virtual bool SetSend(bool send) = 0; |
| 1158 // Mutes the channel. |
| 1159 virtual bool MuteStream(uint32 ssrc, bool on, |
| 1160 const VideoOptions* options) = 0; |
1202 // Sets the renderer object to be used for the specified stream. | 1161 // Sets the renderer object to be used for the specified stream. |
1203 // If SSRC is 0, the renderer is used for the 'default' stream. | 1162 // If SSRC is 0, the renderer is used for the 'default' stream. |
1204 virtual bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) = 0; | 1163 virtual bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) = 0; |
1205 // If |ssrc| is 0, replace the default capturer (engine capturer) with | 1164 // If |ssrc| is 0, replace the default capturer (engine capturer) with |
1206 // |capturer|. If |ssrc| is non zero create a new stream with |ssrc| as SSRC. | 1165 // |capturer|. If |ssrc| is non zero create a new stream with |ssrc| as SSRC. |
1207 virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) = 0; | 1166 virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) = 0; |
1208 // Gets quality stats for the channel. | 1167 // Gets quality stats for the channel. |
1209 virtual bool GetStats(VideoMediaInfo* info) = 0; | 1168 virtual bool GetStats(VideoMediaInfo* info) = 0; |
1210 // Send an intra frame to the receivers. | 1169 // Send an intra frame to the receivers. |
1211 virtual bool SendIntraFrame() = 0; | 1170 virtual bool SendIntraFrame() = 0; |
1212 // Reuqest each of the remote senders to send an intra frame. | 1171 // Reuqest each of the remote senders to send an intra frame. |
1213 virtual bool RequestIntraFrame() = 0; | 1172 virtual bool RequestIntraFrame() = 0; |
1214 // Sets the media options to use. | 1173 // Gets the media options to use. |
1215 virtual bool SetOptions(const VideoOptions& options) = 0; | |
1216 virtual bool GetOptions(VideoOptions* options) const = 0; | 1174 virtual bool GetOptions(VideoOptions* options) const = 0; |
1217 virtual void UpdateAspectRatio(int ratio_w, int ratio_h) = 0; | 1175 virtual void UpdateAspectRatio(int ratio_w, int ratio_h) = 0; |
1218 | 1176 |
1219 // Signal errors from MediaChannel. Arguments are: | 1177 // Signal errors from MediaChannel. Arguments are: |
1220 // ssrc(uint32), and error(VideoMediaChannel::Error). | 1178 // ssrc(uint32), and error(VideoMediaChannel::Error). |
1221 sigslot::signal2<uint32, Error> SignalMediaError; | 1179 sigslot::signal2<uint32, Error> SignalMediaError; |
1222 | 1180 |
1223 protected: | 1181 protected: |
1224 VideoRenderer *renderer_; | 1182 VideoRenderer *renderer_; |
1225 }; | 1183 }; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 ERROR_OTHER, // Other errors. | 1276 ERROR_OTHER, // Other errors. |
1319 ERROR_SEND_SRTP_ERROR = 200, // Generic SRTP failure. | 1277 ERROR_SEND_SRTP_ERROR = 200, // Generic SRTP failure. |
1320 ERROR_SEND_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 1278 ERROR_SEND_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
1321 ERROR_RECV_SRTP_ERROR, // Generic SRTP failure. | 1279 ERROR_RECV_SRTP_ERROR, // Generic SRTP failure. |
1322 ERROR_RECV_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 1280 ERROR_RECV_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
1323 ERROR_RECV_SRTP_REPLAY, // Packet replay detected. | 1281 ERROR_RECV_SRTP_REPLAY, // Packet replay detected. |
1324 }; | 1282 }; |
1325 | 1283 |
1326 virtual ~DataMediaChannel() {} | 1284 virtual ~DataMediaChannel() {} |
1327 | 1285 |
1328 // TODO(pthatcher): Remove SetSendCodecs, | 1286 virtual bool SetSendParameters(const DataSendParameters& params) = 0; |
1329 // SetSendRtpHeaderExtensions, SetMaxSendBandwidth, and SetOptions | 1287 virtual bool SetRecvParameters(const DataRecvParameters& params) = 0; |
1330 // once all implementations implement SetSendParameters. | |
1331 virtual bool SetSendParameters(const DataSendParameters& params) { | |
1332 return (SetSendCodecs(params.codecs) && | |
1333 SetMaxSendBandwidth(params.max_bandwidth_bps)); | |
1334 } | |
1335 // TODO(pthatcher): Remove SetRecvCodecs and | |
1336 // SetRecvRtpHeaderExtensions once all implementations implement | |
1337 // SetRecvParameters. | |
1338 virtual bool SetRecvParameters(const DataRecvParameters& params) { | |
1339 return SetRecvCodecs(params.codecs); | |
1340 } | |
1341 virtual bool SetSendCodecs(const std::vector<DataCodec>& codecs) = 0; | |
1342 virtual bool SetRecvCodecs(const std::vector<DataCodec>& codecs) = 0; | |
1343 | 1288 |
1344 virtual bool MuteStream(uint32 ssrc, bool on) { return false; } | |
1345 // TODO(pthatcher): Implement this. | 1289 // TODO(pthatcher): Implement this. |
1346 virtual bool GetStats(DataMediaInfo* info) { return true; } | 1290 virtual bool GetStats(DataMediaInfo* info) { return true; } |
1347 | 1291 |
1348 virtual bool SetSend(bool send) = 0; | 1292 virtual bool SetSend(bool send) = 0; |
1349 virtual bool SetReceive(bool receive) = 0; | 1293 virtual bool SetReceive(bool receive) = 0; |
1350 | 1294 |
1351 virtual bool SendData( | 1295 virtual bool SendData( |
1352 const SendDataParams& params, | 1296 const SendDataParams& params, |
1353 const rtc::Buffer& payload, | 1297 const rtc::Buffer& payload, |
1354 SendDataResult* result = NULL) = 0; | 1298 SendDataResult* result = NULL) = 0; |
1355 // Signals when data is received (params, data, len) | 1299 // Signals when data is received (params, data, len) |
1356 sigslot::signal3<const ReceiveDataParams&, | 1300 sigslot::signal3<const ReceiveDataParams&, |
1357 const char*, | 1301 const char*, |
1358 size_t> SignalDataReceived; | 1302 size_t> SignalDataReceived; |
1359 // Signal errors from MediaChannel. Arguments are: | 1303 // Signal errors from MediaChannel. Arguments are: |
1360 // ssrc(uint32), and error(DataMediaChannel::Error). | 1304 // ssrc(uint32), and error(DataMediaChannel::Error). |
1361 sigslot::signal2<uint32, DataMediaChannel::Error> SignalMediaError; | 1305 sigslot::signal2<uint32, DataMediaChannel::Error> SignalMediaError; |
1362 // Signal when the media channel is ready to send the stream. Arguments are: | 1306 // Signal when the media channel is ready to send the stream. Arguments are: |
1363 // writable(bool) | 1307 // writable(bool) |
1364 sigslot::signal1<bool> SignalReadyToSend; | 1308 sigslot::signal1<bool> SignalReadyToSend; |
1365 // Signal for notifying that the remote side has closed the DataChannel. | 1309 // Signal for notifying that the remote side has closed the DataChannel. |
1366 sigslot::signal1<uint32> SignalStreamClosedRemotely; | 1310 sigslot::signal1<uint32> SignalStreamClosedRemotely; |
1367 }; | 1311 }; |
1368 | 1312 |
1369 } // namespace cricket | 1313 } // namespace cricket |
1370 | 1314 |
1371 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ | 1315 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ |
OLD | NEW |