Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(910)

Side by Side Diff: talk/media/base/mediachannel.h

Issue 1327933002: Full impl of NnChannel::SetSendParameters and NnChannel::SetRecvParameters (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « talk/media/base/fakemediaengine.h ('k') | talk/media/base/rtpdataengine.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Sets the RTP extension headers and IDs to use when sending RTP.
570 virtual bool SetRecvRtpHeaderExtensions(
571 const std::vector<RtpHeaderExtension>& extensions) = 0;
572 virtual bool SetSendRtpHeaderExtensions(
573 const std::vector<RtpHeaderExtension>& extensions) = 0;
574 // Returns the absoulte sendtime extension id value from media channel. 569 // Returns the absoulte sendtime extension id value from media channel.
575 virtual int GetRtpSendTimeExtnId() const { 570 virtual int GetRtpSendTimeExtnId() const {
576 return -1; 571 return -1;
577 } 572 }
578 // Sets the maximum allowed bandwidth to use when sending data.
579 virtual bool SetMaxSendBandwidth(int bps) = 0;
580 573
581 // Base method to send packet using NetworkInterface. 574 // Base method to send packet using NetworkInterface.
582 bool SendPacket(rtc::Buffer* packet) { 575 bool SendPacket(rtc::Buffer* packet) {
583 return DoSendPacket(packet, false); 576 return DoSendPacket(packet, false);
584 } 577 }
585 578
586 bool SendRtcp(rtc::Buffer* packet) { 579 bool SendRtcp(rtc::Buffer* packet) {
587 return DoSendPacket(packet, true); 580 return DoSendPacket(packet, true);
588 } 581 }
589 582
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 ERROR_PLAY_DEVICE_MUTED, // Playout muted by OS. 1056 ERROR_PLAY_DEVICE_MUTED, // Playout muted by OS.
1064 ERROR_PLAY_DEVICE_REMOVED, // Playout removed while active. 1057 ERROR_PLAY_DEVICE_REMOVED, // Playout removed while active.
1065 ERROR_PLAY_RUNTIME_ERROR, // Errors in voice processing. 1058 ERROR_PLAY_RUNTIME_ERROR, // Errors in voice processing.
1066 ERROR_PLAY_SRTP_ERROR, // Generic SRTP failure. 1059 ERROR_PLAY_SRTP_ERROR, // Generic SRTP failure.
1067 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. 1060 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets.
1068 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. 1061 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected.
1069 }; 1062 };
1070 1063
1071 VoiceMediaChannel() {} 1064 VoiceMediaChannel() {}
1072 virtual ~VoiceMediaChannel() {} 1065 virtual ~VoiceMediaChannel() {}
1073 // TODO(pthatcher): Remove SetSendCodecs, 1066 virtual bool SetSendParameters(const AudioSendParameters& params) = 0;
1074 // SetSendRtpHeaderExtensions, SetMaxSendBandwidth, and SetOptions 1067 virtual bool SetRecvParameters(const AudioRecvParameters& params) = 0;
1075 // once all implementations implement SetSendParameters.
1076 virtual bool SetSendParameters(const AudioSendParameters& params) {
1077 return (SetSendCodecs(params.codecs) &&
1078 SetSendRtpHeaderExtensions(params.extensions) &&
1079 SetMaxSendBandwidth(params.max_bandwidth_bps) &&
1080 SetOptions(params.options));
1081 }
1082 // TODO(pthatcher): Remove SetRecvCodecs and
1083 // SetRecvRtpHeaderExtensions once all implementations implement
1084 // SetRecvParameters.
1085 virtual bool SetRecvParameters(const AudioRecvParameters& params) {
1086 return (SetRecvCodecs(params.codecs) &&
1087 SetRecvRtpHeaderExtensions(params.extensions));
1088 }
1089 // Sets the codecs/payload types to be used for incoming media.
1090 virtual bool SetRecvCodecs(const std::vector<AudioCodec>& codecs) = 0;
1091 // Sets the codecs/payload types to be used for outgoing media.
1092 virtual bool SetSendCodecs(const std::vector<AudioCodec>& codecs) = 0;
1093 // Starts or stops playout of received audio. 1068 // Starts or stops playout of received audio.
1094 virtual bool SetPlayout(bool playout) = 0; 1069 virtual bool SetPlayout(bool playout) = 0;
1095 // Starts or stops sending (and potentially capture) of local audio. 1070 // Starts or stops sending (and potentially capture) of local audio.
1096 virtual bool SetSend(SendFlags flag) = 0; 1071 virtual bool SetSend(SendFlags flag) = 0;
1097 // Configure stream for sending. 1072 // Configure stream for sending.
1098 virtual bool SetAudioSend(uint32 ssrc, bool mute, const AudioOptions* options, 1073 virtual bool SetAudioSend(uint32 ssrc, bool mute, const AudioOptions* options,
1099 AudioRenderer* renderer) = 0; 1074 AudioRenderer* renderer) = 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 // Gets current energy levels for all incoming streams. 1077 // Gets current energy levels for all incoming streams.
(...skipping 21 matching lines...) Expand all
1124 // DTMF event 0-9, *, #, A-D. 1099 // DTMF event 0-9, *, #, A-D.
1125 virtual bool InsertDtmf(uint32 ssrc, int event, int duration, int flags) = 0; 1100 virtual bool InsertDtmf(uint32 ssrc, int event, int duration, int flags) = 0;
1126 // Gets quality stats for the channel. 1101 // Gets quality stats for the channel.
1127 virtual bool GetStats(VoiceMediaInfo* info) = 0; 1102 virtual bool GetStats(VoiceMediaInfo* info) = 0;
1128 // Gets last reported error for this media channel. 1103 // Gets last reported error for this media channel.
1129 virtual void GetLastMediaError(uint32* ssrc, 1104 virtual void GetLastMediaError(uint32* ssrc,
1130 VoiceMediaChannel::Error* error) { 1105 VoiceMediaChannel::Error* error) {
1131 ASSERT(error != NULL); 1106 ASSERT(error != NULL);
1132 *error = ERROR_NONE; 1107 *error = ERROR_NONE;
1133 } 1108 }
1134 // Sets the media options to use.
1135 virtual bool SetOptions(const AudioOptions& options) = 0;
1136 1109
1137 // Signal errors from MediaChannel. Arguments are: 1110 // Signal errors from MediaChannel. Arguments are:
1138 // ssrc(uint32), and error(VoiceMediaChannel::Error). 1111 // ssrc(uint32), and error(VoiceMediaChannel::Error).
1139 sigslot::signal2<uint32, VoiceMediaChannel::Error> SignalMediaError; 1112 sigslot::signal2<uint32, VoiceMediaChannel::Error> SignalMediaError;
1140 }; 1113 };
1141 1114
1142 struct VideoSendParameters : RtpSendParameters<VideoCodec, VideoOptions> { 1115 struct VideoSendParameters : RtpSendParameters<VideoCodec, VideoOptions> {
1143 }; 1116 };
1144 1117
1145 struct VideoRecvParameters : RtpParameters<VideoCodec> { 1118 struct VideoRecvParameters : RtpParameters<VideoCodec> {
(...skipping 11 matching lines...) Expand all
1157 ERROR_REC_SRTP_ERROR, // Generic sender SRTP failure. 1130 ERROR_REC_SRTP_ERROR, // Generic sender SRTP failure.
1158 ERROR_REC_SRTP_AUTH_FAILED, // Failed to authenticate packets. 1131 ERROR_REC_SRTP_AUTH_FAILED, // Failed to authenticate packets.
1159 ERROR_REC_CPU_MAX_CANT_DOWNGRADE, // Can't downgrade capture anymore. 1132 ERROR_REC_CPU_MAX_CANT_DOWNGRADE, // Can't downgrade capture anymore.
1160 ERROR_PLAY_SRTP_ERROR = 200, // Generic receiver SRTP failure. 1133 ERROR_PLAY_SRTP_ERROR = 200, // Generic receiver SRTP failure.
1161 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. 1134 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets.
1162 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. 1135 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected.
1163 }; 1136 };
1164 1137
1165 VideoMediaChannel() : renderer_(NULL) {} 1138 VideoMediaChannel() : renderer_(NULL) {}
1166 virtual ~VideoMediaChannel() {} 1139 virtual ~VideoMediaChannel() {}
1167 // TODO(pthatcher): Remove SetSendCodecs, 1140
1168 // SetSendRtpHeaderExtensions, SetMaxSendBandwidth, and SetOptions 1141 virtual bool SetSendParameters(const VideoSendParameters& params) = 0;
1169 // once all implementations implement SetSendParameters. 1142 virtual bool SetRecvParameters(const VideoRecvParameters& params) = 0;
1170 virtual bool SetSendParameters(const VideoSendParameters& params) {
1171 return (SetSendCodecs(params.codecs) &&
1172 SetSendRtpHeaderExtensions(params.extensions) &&
1173 SetMaxSendBandwidth(params.max_bandwidth_bps) &&
1174 SetOptions(params.options));
1175 }
1176 // TODO(pthatcher): Remove SetRecvCodecs and
1177 // SetRecvRtpHeaderExtensions once all implementations implement
1178 // SetRecvParameters.
1179 virtual bool SetRecvParameters(const VideoRecvParameters& params) {
1180 return (SetRecvCodecs(params.codecs) &&
1181 SetRecvRtpHeaderExtensions(params.extensions));
1182 }
1183 // Sets the codecs/payload types to be used for incoming media.
1184 virtual bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) = 0;
1185 // Sets the codecs/payload types to be used for outgoing media.
1186 virtual bool SetSendCodecs(const std::vector<VideoCodec>& codecs) = 0;
1187 // Gets the currently set codecs/payload types to be used for outgoing media. 1143 // Gets the currently set codecs/payload types to be used for outgoing media.
1188 virtual bool GetSendCodec(VideoCodec* send_codec) = 0; 1144 virtual bool GetSendCodec(VideoCodec* send_codec) = 0;
1189 // Sets the format of a specified outgoing stream. 1145 // Sets the format of a specified outgoing stream.
1190 virtual bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) = 0; 1146 virtual bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) = 0;
1191 // Starts or stops playout of received video. 1147 // Starts or stops playout of received video.
1192 virtual bool SetRender(bool render) = 0; 1148 virtual bool SetRender(bool render) = 0;
1193 // Starts or stops transmission (and potentially capture) of local video. 1149 // Starts or stops transmission (and potentially capture) of local video.
1194 virtual bool SetSend(bool send) = 0; 1150 virtual bool SetSend(bool send) = 0;
1195 // Configure stream for sending. 1151 // Configure stream for sending.
1196 virtual bool SetVideoSend(uint32 ssrc, bool mute, 1152 virtual bool SetVideoSend(uint32 ssrc, bool mute,
1197 const VideoOptions* options) = 0; 1153 const VideoOptions* options) = 0;
1198 // Sets the renderer object to be used for the specified stream. 1154 // Sets the renderer object to be used for the specified stream.
1199 // If SSRC is 0, the renderer is used for the 'default' stream. 1155 // If SSRC is 0, the renderer is used for the 'default' stream.
1200 virtual bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) = 0; 1156 virtual bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) = 0;
1201 // If |ssrc| is 0, replace the default capturer (engine capturer) with 1157 // If |ssrc| is 0, replace the default capturer (engine capturer) with
1202 // |capturer|. If |ssrc| is non zero create a new stream with |ssrc| as SSRC. 1158 // |capturer|. If |ssrc| is non zero create a new stream with |ssrc| as SSRC.
1203 virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) = 0; 1159 virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) = 0;
1204 // Gets quality stats for the channel. 1160 // Gets quality stats for the channel.
1205 virtual bool GetStats(VideoMediaInfo* info) = 0; 1161 virtual bool GetStats(VideoMediaInfo* info) = 0;
1206 // Send an intra frame to the receivers. 1162 // Send an intra frame to the receivers.
1207 virtual bool SendIntraFrame() = 0; 1163 virtual bool SendIntraFrame() = 0;
1208 // Reuqest each of the remote senders to send an intra frame. 1164 // Reuqest each of the remote senders to send an intra frame.
1209 virtual bool RequestIntraFrame() = 0; 1165 virtual bool RequestIntraFrame() = 0;
1210 // Sets the media options to use.
1211 virtual bool SetOptions(const VideoOptions& options) = 0;
1212 virtual void UpdateAspectRatio(int ratio_w, int ratio_h) = 0; 1166 virtual void UpdateAspectRatio(int ratio_w, int ratio_h) = 0;
1213 1167
1214 // Signal errors from MediaChannel. Arguments are: 1168 // Signal errors from MediaChannel. Arguments are:
1215 // ssrc(uint32), and error(VideoMediaChannel::Error). 1169 // ssrc(uint32), and error(VideoMediaChannel::Error).
1216 sigslot::signal2<uint32, Error> SignalMediaError; 1170 sigslot::signal2<uint32, Error> SignalMediaError;
1217 1171
1218 protected: 1172 protected:
1219 VideoRenderer *renderer_; 1173 VideoRenderer *renderer_;
1220 }; 1174 };
1221 1175
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 ERROR_OTHER, // Other errors. 1267 ERROR_OTHER, // Other errors.
1314 ERROR_SEND_SRTP_ERROR = 200, // Generic SRTP failure. 1268 ERROR_SEND_SRTP_ERROR = 200, // Generic SRTP failure.
1315 ERROR_SEND_SRTP_AUTH_FAILED, // Failed to authenticate packets. 1269 ERROR_SEND_SRTP_AUTH_FAILED, // Failed to authenticate packets.
1316 ERROR_RECV_SRTP_ERROR, // Generic SRTP failure. 1270 ERROR_RECV_SRTP_ERROR, // Generic SRTP failure.
1317 ERROR_RECV_SRTP_AUTH_FAILED, // Failed to authenticate packets. 1271 ERROR_RECV_SRTP_AUTH_FAILED, // Failed to authenticate packets.
1318 ERROR_RECV_SRTP_REPLAY, // Packet replay detected. 1272 ERROR_RECV_SRTP_REPLAY, // Packet replay detected.
1319 }; 1273 };
1320 1274
1321 virtual ~DataMediaChannel() {} 1275 virtual ~DataMediaChannel() {}
1322 1276
1323 // TODO(pthatcher): Remove SetSendCodecs, 1277 virtual bool SetSendParameters(const DataSendParameters& params) = 0;
1324 // SetSendRtpHeaderExtensions, SetMaxSendBandwidth, and SetOptions 1278 virtual bool SetRecvParameters(const DataRecvParameters& params) = 0;
1325 // once all implementations implement SetSendParameters.
1326 virtual bool SetSendParameters(const DataSendParameters& params) {
1327 return (SetSendCodecs(params.codecs) &&
1328 SetMaxSendBandwidth(params.max_bandwidth_bps));
1329 }
1330 // TODO(pthatcher): Remove SetRecvCodecs and
1331 // SetRecvRtpHeaderExtensions once all implementations implement
1332 // SetRecvParameters.
1333 virtual bool SetRecvParameters(const DataRecvParameters& params) {
1334 return SetRecvCodecs(params.codecs);
1335 }
1336 virtual bool SetSendCodecs(const std::vector<DataCodec>& codecs) = 0;
1337 virtual bool SetRecvCodecs(const std::vector<DataCodec>& codecs) = 0;
1338 1279
1339 // TODO(pthatcher): Implement this. 1280 // TODO(pthatcher): Implement this.
1340 virtual bool GetStats(DataMediaInfo* info) { return true; } 1281 virtual bool GetStats(DataMediaInfo* info) { return true; }
1341 1282
1342 virtual bool SetSend(bool send) = 0; 1283 virtual bool SetSend(bool send) = 0;
1343 virtual bool SetReceive(bool receive) = 0; 1284 virtual bool SetReceive(bool receive) = 0;
1344 1285
1345 virtual bool SendData( 1286 virtual bool SendData(
1346 const SendDataParams& params, 1287 const SendDataParams& params,
1347 const rtc::Buffer& payload, 1288 const rtc::Buffer& payload,
1348 SendDataResult* result = NULL) = 0; 1289 SendDataResult* result = NULL) = 0;
1349 // Signals when data is received (params, data, len) 1290 // Signals when data is received (params, data, len)
1350 sigslot::signal3<const ReceiveDataParams&, 1291 sigslot::signal3<const ReceiveDataParams&,
1351 const char*, 1292 const char*,
1352 size_t> SignalDataReceived; 1293 size_t> SignalDataReceived;
1353 // Signal errors from MediaChannel. Arguments are: 1294 // Signal errors from MediaChannel. Arguments are:
1354 // ssrc(uint32), and error(DataMediaChannel::Error). 1295 // ssrc(uint32), and error(DataMediaChannel::Error).
1355 sigslot::signal2<uint32, DataMediaChannel::Error> SignalMediaError; 1296 sigslot::signal2<uint32, DataMediaChannel::Error> SignalMediaError;
1356 // Signal when the media channel is ready to send the stream. Arguments are: 1297 // Signal when the media channel is ready to send the stream. Arguments are:
1357 // writable(bool) 1298 // writable(bool)
1358 sigslot::signal1<bool> SignalReadyToSend; 1299 sigslot::signal1<bool> SignalReadyToSend;
1359 // Signal for notifying that the remote side has closed the DataChannel. 1300 // Signal for notifying that the remote side has closed the DataChannel.
1360 sigslot::signal1<uint32> SignalStreamClosedRemotely; 1301 sigslot::signal1<uint32> SignalStreamClosedRemotely;
1361 }; 1302 };
1362 1303
1363 } // namespace cricket 1304 } // namespace cricket
1364 1305
1365 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ 1306 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_
OLDNEW
« no previous file with comments | « talk/media/base/fakemediaengine.h ('k') | talk/media/base/rtpdataengine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698