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

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
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;
pthatcher1 2015/09/14 19:42:02 Instead of "bool mute", can we have it be "bool se
the sun 2015/09/16 13:01:50 I agree, but it is hardly related to this CL.
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.
1103 virtual bool GetActiveStreams(AudioInfo::StreamList* actives) = 0; 1078 virtual bool GetActiveStreams(AudioInfo::StreamList* actives) = 0;
1104 // Get the current energy level of the stream sent to the speaker. 1079 // Get the current energy level of the stream sent to the speaker.
1105 virtual int GetOutputLevel() = 0; 1080 virtual int GetOutputLevel() = 0;
1106 // Get the time in milliseconds since last recorded keystroke, or negative. 1081 // Get the time in milliseconds since last recorded keystroke, or negative.
1107 virtual int GetTimeSinceLastTyping() = 0; 1082 virtual int GetTimeSinceLastTyping() = 0;
1108 // Temporarily exposed field for tuning typing detect options. 1083 // Temporarily exposed field for tuning typing detect options.
1109 virtual void SetTypingDetectionParameters(int time_window, 1084 virtual void SetTypingDetectionParameters(int time_window,
(...skipping 14 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 13 matching lines...) Expand all
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 // Allow video channel to unhook itself from an associated voice channel. 1140 // Allow video channel to unhook itself from an associated voice channel.
1168 virtual void DetachVoiceChannel() = 0; 1141 virtual void DetachVoiceChannel() = 0;
1169 // TODO(pthatcher): Remove SetSendCodecs, 1142 virtual bool SetSendParameters(const VideoSendParameters& params) = 0;
1170 // SetSendRtpHeaderExtensions, SetMaxSendBandwidth, and SetOptions 1143 virtual bool SetRecvParameters(const VideoRecvParameters& params) = 0;
1171 // once all implementations implement SetSendParameters.
1172 virtual bool SetSendParameters(const VideoSendParameters& params) {
1173 return (SetSendCodecs(params.codecs) &&
1174 SetSendRtpHeaderExtensions(params.extensions) &&
1175 SetMaxSendBandwidth(params.max_bandwidth_bps) &&
1176 SetOptions(params.options));
1177 }
1178 // TODO(pthatcher): Remove SetRecvCodecs and
1179 // SetRecvRtpHeaderExtensions once all implementations implement
1180 // SetRecvParameters.
1181 virtual bool SetRecvParameters(const VideoRecvParameters& params) {
1182 return (SetRecvCodecs(params.codecs) &&
1183 SetRecvRtpHeaderExtensions(params.extensions));
1184 }
1185 // Sets the codecs/payload types to be used for incoming media.
1186 virtual bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) = 0;
1187 // Sets the codecs/payload types to be used for outgoing media.
1188 virtual bool SetSendCodecs(const std::vector<VideoCodec>& codecs) = 0;
1189 // Gets the currently set codecs/payload types to be used for outgoing media. 1144 // Gets the currently set codecs/payload types to be used for outgoing media.
1190 virtual bool GetSendCodec(VideoCodec* send_codec) = 0; 1145 virtual bool GetSendCodec(VideoCodec* send_codec) = 0;
1191 // Sets the format of a specified outgoing stream. 1146 // Sets the format of a specified outgoing stream.
1192 virtual bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) = 0; 1147 virtual bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) = 0;
1193 // Starts or stops playout of received video. 1148 // Starts or stops playout of received video.
1194 virtual bool SetRender(bool render) = 0; 1149 virtual bool SetRender(bool render) = 0;
1195 // Starts or stops transmission (and potentially capture) of local video. 1150 // Starts or stops transmission (and potentially capture) of local video.
1196 virtual bool SetSend(bool send) = 0; 1151 virtual bool SetSend(bool send) = 0;
1197 // Configure stream for sending. 1152 // Configure stream for sending.
1198 virtual bool SetVideoSend(uint32 ssrc, bool mute, 1153 virtual bool SetVideoSend(uint32 ssrc, bool mute,
pthatcher1 2015/09/14 19:42:02 Same here.
the sun 2015/09/16 13:01:50 Ditto.
1199 const VideoOptions* options) = 0; 1154 const VideoOptions* options) = 0;
1200 // Sets the renderer object to be used for the specified stream. 1155 // Sets the renderer object to be used for the specified stream.
1201 // If SSRC is 0, the renderer is used for the 'default' stream. 1156 // If SSRC is 0, the renderer is used for the 'default' stream.
1202 virtual bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) = 0; 1157 virtual bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) = 0;
1203 // If |ssrc| is 0, replace the default capturer (engine capturer) with 1158 // If |ssrc| is 0, replace the default capturer (engine capturer) with
1204 // |capturer|. If |ssrc| is non zero create a new stream with |ssrc| as SSRC. 1159 // |capturer|. If |ssrc| is non zero create a new stream with |ssrc| as SSRC.
1205 virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) = 0; 1160 virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) = 0;
1206 // Gets quality stats for the channel. 1161 // Gets quality stats for the channel.
1207 virtual bool GetStats(VideoMediaInfo* info) = 0; 1162 virtual bool GetStats(VideoMediaInfo* info) = 0;
1208 // Send an intra frame to the receivers. 1163 // Send an intra frame to the receivers.
1209 virtual bool SendIntraFrame() = 0; 1164 virtual bool SendIntraFrame() = 0;
1210 // Reuqest each of the remote senders to send an intra frame. 1165 // Reuqest each of the remote senders to send an intra frame.
1211 virtual bool RequestIntraFrame() = 0; 1166 virtual bool RequestIntraFrame() = 0;
1212 // Sets the media options to use.
1213 virtual bool SetOptions(const VideoOptions& options) = 0;
1214 virtual void UpdateAspectRatio(int ratio_w, int ratio_h) = 0; 1167 virtual void UpdateAspectRatio(int ratio_w, int ratio_h) = 0;
1215 1168
1216 // Signal errors from MediaChannel. Arguments are: 1169 // Signal errors from MediaChannel. Arguments are:
1217 // ssrc(uint32), and error(VideoMediaChannel::Error). 1170 // ssrc(uint32), and error(VideoMediaChannel::Error).
1218 sigslot::signal2<uint32, Error> SignalMediaError; 1171 sigslot::signal2<uint32, Error> SignalMediaError;
1219 1172
1220 protected: 1173 protected:
1221 VideoRenderer *renderer_; 1174 VideoRenderer *renderer_;
1222 }; 1175 };
1223 1176
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 ERROR_OTHER, // Other errors. 1268 ERROR_OTHER, // Other errors.
1316 ERROR_SEND_SRTP_ERROR = 200, // Generic SRTP failure. 1269 ERROR_SEND_SRTP_ERROR = 200, // Generic SRTP failure.
1317 ERROR_SEND_SRTP_AUTH_FAILED, // Failed to authenticate packets. 1270 ERROR_SEND_SRTP_AUTH_FAILED, // Failed to authenticate packets.
1318 ERROR_RECV_SRTP_ERROR, // Generic SRTP failure. 1271 ERROR_RECV_SRTP_ERROR, // Generic SRTP failure.
1319 ERROR_RECV_SRTP_AUTH_FAILED, // Failed to authenticate packets. 1272 ERROR_RECV_SRTP_AUTH_FAILED, // Failed to authenticate packets.
1320 ERROR_RECV_SRTP_REPLAY, // Packet replay detected. 1273 ERROR_RECV_SRTP_REPLAY, // Packet replay detected.
1321 }; 1274 };
1322 1275
1323 virtual ~DataMediaChannel() {} 1276 virtual ~DataMediaChannel() {}
1324 1277
1325 // TODO(pthatcher): Remove SetSendCodecs, 1278 virtual bool SetSendParameters(const DataSendParameters& params) = 0;
1326 // SetSendRtpHeaderExtensions, SetMaxSendBandwidth, and SetOptions 1279 virtual bool SetRecvParameters(const DataRecvParameters& params) = 0;
1327 // once all implementations implement SetSendParameters.
1328 virtual bool SetSendParameters(const DataSendParameters& params) {
1329 return (SetSendCodecs(params.codecs) &&
1330 SetMaxSendBandwidth(params.max_bandwidth_bps));
1331 }
1332 // TODO(pthatcher): Remove SetRecvCodecs and
1333 // SetRecvRtpHeaderExtensions once all implementations implement
1334 // SetRecvParameters.
1335 virtual bool SetRecvParameters(const DataRecvParameters& params) {
1336 return SetRecvCodecs(params.codecs);
1337 }
1338 virtual bool SetSendCodecs(const std::vector<DataCodec>& codecs) = 0;
1339 virtual bool SetRecvCodecs(const std::vector<DataCodec>& codecs) = 0;
1340 1280
1341 // TODO(pthatcher): Implement this. 1281 // TODO(pthatcher): Implement this.
1342 virtual bool GetStats(DataMediaInfo* info) { return true; } 1282 virtual bool GetStats(DataMediaInfo* info) { return true; }
1343 1283
1344 virtual bool SetSend(bool send) = 0; 1284 virtual bool SetSend(bool send) = 0;
1345 virtual bool SetReceive(bool receive) = 0; 1285 virtual bool SetReceive(bool receive) = 0;
1346 1286
1347 virtual bool SendData( 1287 virtual bool SendData(
1348 const SendDataParams& params, 1288 const SendDataParams& params,
1349 const rtc::Buffer& payload, 1289 const rtc::Buffer& payload,
1350 SendDataResult* result = NULL) = 0; 1290 SendDataResult* result = NULL) = 0;
1351 // Signals when data is received (params, data, len) 1291 // Signals when data is received (params, data, len)
1352 sigslot::signal3<const ReceiveDataParams&, 1292 sigslot::signal3<const ReceiveDataParams&,
1353 const char*, 1293 const char*,
1354 size_t> SignalDataReceived; 1294 size_t> SignalDataReceived;
1355 // Signal errors from MediaChannel. Arguments are: 1295 // Signal errors from MediaChannel. Arguments are:
1356 // ssrc(uint32), and error(DataMediaChannel::Error). 1296 // ssrc(uint32), and error(DataMediaChannel::Error).
1357 sigslot::signal2<uint32, DataMediaChannel::Error> SignalMediaError; 1297 sigslot::signal2<uint32, DataMediaChannel::Error> SignalMediaError;
1358 // Signal when the media channel is ready to send the stream. Arguments are: 1298 // Signal when the media channel is ready to send the stream. Arguments are:
1359 // writable(bool) 1299 // writable(bool)
1360 sigslot::signal1<bool> SignalReadyToSend; 1300 sigslot::signal1<bool> SignalReadyToSend;
1361 // Signal for notifying that the remote side has closed the DataChannel. 1301 // Signal for notifying that the remote side has closed the DataChannel.
1362 sigslot::signal1<uint32> SignalStreamClosedRemotely; 1302 sigslot::signal1<uint32> SignalStreamClosedRemotely;
1363 }; 1303 };
1364 1304
1365 } // namespace cricket 1305 } // namespace cricket
1366 1306
1367 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_ 1307 #endif // TALK_MEDIA_BASE_MEDIACHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698