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 |
11 #ifndef WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ | 11 #ifndef WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ |
12 #define WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ | 12 #define WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ |
13 | 13 |
| 14 #include <algorithm> |
14 #include <memory> | 15 #include <memory> |
15 #include <string> | 16 #include <string> |
16 #include <vector> | 17 #include <vector> |
17 | 18 |
18 #include "webrtc/api/rtpparameters.h" | 19 #include "webrtc/api/rtpparameters.h" |
19 #include "webrtc/base/basictypes.h" | 20 #include "webrtc/base/basictypes.h" |
20 #include "webrtc/base/buffer.h" | 21 #include "webrtc/base/buffer.h" |
21 #include "webrtc/base/copyonwritebuffer.h" | 22 #include "webrtc/base/copyonwritebuffer.h" |
22 #include "webrtc/base/dscp.h" | 23 #include "webrtc/base/dscp.h" |
23 #include "webrtc/base/logging.h" | 24 #include "webrtc/base/logging.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 enum SocketType { ST_RTP, ST_RTCP }; | 346 enum SocketType { ST_RTP, ST_RTCP }; |
346 virtual bool SendPacket(rtc::CopyOnWriteBuffer* packet, | 347 virtual bool SendPacket(rtc::CopyOnWriteBuffer* packet, |
347 const rtc::PacketOptions& options) = 0; | 348 const rtc::PacketOptions& options) = 0; |
348 virtual bool SendRtcp(rtc::CopyOnWriteBuffer* packet, | 349 virtual bool SendRtcp(rtc::CopyOnWriteBuffer* packet, |
349 const rtc::PacketOptions& options) = 0; | 350 const rtc::PacketOptions& options) = 0; |
350 virtual int SetOption(SocketType type, rtc::Socket::Option opt, | 351 virtual int SetOption(SocketType type, rtc::Socket::Option opt, |
351 int option) = 0; | 352 int option) = 0; |
352 virtual ~NetworkInterface() {} | 353 virtual ~NetworkInterface() {} |
353 }; | 354 }; |
354 | 355 |
355 MediaChannel(const MediaConfig& config) | 356 explicit MediaChannel(const MediaConfig& config) |
356 : enable_dscp_(config.enable_dscp), network_interface_(NULL) {} | 357 : enable_dscp_(config.enable_dscp), network_interface_(NULL) {} |
357 MediaChannel() : enable_dscp_(false), network_interface_(NULL) {} | 358 MediaChannel() : enable_dscp_(false), network_interface_(NULL) {} |
358 virtual ~MediaChannel() {} | 359 virtual ~MediaChannel() {} |
359 | 360 |
360 // Sets the abstract interface class for sending RTP/RTCP data. | 361 // Sets the abstract interface class for sending RTP/RTCP data. |
361 virtual void SetInterface(NetworkInterface *iface) { | 362 virtual void SetInterface(NetworkInterface *iface) { |
362 rtc::CritScope cs(&network_interface_crit_); | 363 rtc::CritScope cs(&network_interface_crit_); |
363 network_interface_ = iface; | 364 network_interface_ = iface; |
364 SetDscp(enable_dscp_ ? PreferredDscp() : rtc::DSCP_DEFAULT); | 365 SetDscp(enable_dscp_ ? PreferredDscp() : rtc::DSCP_DEFAULT); |
365 } | 366 } |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 ERROR_PLAY_DEVICE_OPEN_FAILED = 200, // Could not open playout. | 880 ERROR_PLAY_DEVICE_OPEN_FAILED = 200, // Could not open playout. |
880 ERROR_PLAY_DEVICE_MUTED, // Playout muted by OS. | 881 ERROR_PLAY_DEVICE_MUTED, // Playout muted by OS. |
881 ERROR_PLAY_DEVICE_REMOVED, // Playout removed while active. | 882 ERROR_PLAY_DEVICE_REMOVED, // Playout removed while active. |
882 ERROR_PLAY_RUNTIME_ERROR, // Errors in voice processing. | 883 ERROR_PLAY_RUNTIME_ERROR, // Errors in voice processing. |
883 ERROR_PLAY_SRTP_ERROR, // Generic SRTP failure. | 884 ERROR_PLAY_SRTP_ERROR, // Generic SRTP failure. |
884 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 885 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
885 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. | 886 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. |
886 }; | 887 }; |
887 | 888 |
888 VoiceMediaChannel() {} | 889 VoiceMediaChannel() {} |
889 VoiceMediaChannel(const MediaConfig& config) : MediaChannel(config) {} | 890 explicit VoiceMediaChannel(const MediaConfig& config) |
| 891 : MediaChannel(config) {} |
890 virtual ~VoiceMediaChannel() {} | 892 virtual ~VoiceMediaChannel() {} |
891 virtual bool SetSendParameters(const AudioSendParameters& params) = 0; | 893 virtual bool SetSendParameters(const AudioSendParameters& params) = 0; |
892 virtual bool SetRecvParameters(const AudioRecvParameters& params) = 0; | 894 virtual bool SetRecvParameters(const AudioRecvParameters& params) = 0; |
893 virtual webrtc::RtpParameters GetRtpSendParameters(uint32_t ssrc) const = 0; | 895 virtual webrtc::RtpParameters GetRtpSendParameters(uint32_t ssrc) const = 0; |
894 virtual bool SetRtpSendParameters( | 896 virtual bool SetRtpSendParameters( |
895 uint32_t ssrc, | 897 uint32_t ssrc, |
896 const webrtc::RtpParameters& parameters) = 0; | 898 const webrtc::RtpParameters& parameters) = 0; |
897 virtual webrtc::RtpParameters GetRtpReceiveParameters( | 899 virtual webrtc::RtpParameters GetRtpReceiveParameters( |
898 uint32_t ssrc) const = 0; | 900 uint32_t ssrc) const = 0; |
899 virtual bool SetRtpReceiveParameters( | 901 virtual bool SetRtpReceiveParameters( |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 ERROR_REC_DEVICE_REMOVED, // Device is removed. | 965 ERROR_REC_DEVICE_REMOVED, // Device is removed. |
964 ERROR_REC_SRTP_ERROR, // Generic sender SRTP failure. | 966 ERROR_REC_SRTP_ERROR, // Generic sender SRTP failure. |
965 ERROR_REC_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 967 ERROR_REC_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
966 ERROR_REC_CPU_MAX_CANT_DOWNGRADE, // Can't downgrade capture anymore. | 968 ERROR_REC_CPU_MAX_CANT_DOWNGRADE, // Can't downgrade capture anymore. |
967 ERROR_PLAY_SRTP_ERROR = 200, // Generic receiver SRTP failure. | 969 ERROR_PLAY_SRTP_ERROR = 200, // Generic receiver SRTP failure. |
968 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 970 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
969 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. | 971 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. |
970 }; | 972 }; |
971 | 973 |
972 VideoMediaChannel() {} | 974 VideoMediaChannel() {} |
973 VideoMediaChannel(const MediaConfig& config) : MediaChannel(config) {} | 975 explicit VideoMediaChannel(const MediaConfig& config) |
| 976 : MediaChannel(config) {} |
974 virtual ~VideoMediaChannel() {} | 977 virtual ~VideoMediaChannel() {} |
975 | 978 |
976 virtual bool SetSendParameters(const VideoSendParameters& params) = 0; | 979 virtual bool SetSendParameters(const VideoSendParameters& params) = 0; |
977 virtual bool SetRecvParameters(const VideoRecvParameters& params) = 0; | 980 virtual bool SetRecvParameters(const VideoRecvParameters& params) = 0; |
978 virtual webrtc::RtpParameters GetRtpSendParameters(uint32_t ssrc) const = 0; | 981 virtual webrtc::RtpParameters GetRtpSendParameters(uint32_t ssrc) const = 0; |
979 virtual bool SetRtpSendParameters( | 982 virtual bool SetRtpSendParameters( |
980 uint32_t ssrc, | 983 uint32_t ssrc, |
981 const webrtc::RtpParameters& parameters) = 0; | 984 const webrtc::RtpParameters& parameters) = 0; |
982 virtual webrtc::RtpParameters GetRtpReceiveParameters( | 985 virtual webrtc::RtpParameters GetRtpReceiveParameters( |
983 uint32_t ssrc) const = 0; | 986 uint32_t ssrc) const = 0; |
(...skipping 138 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: | 1125 // Signal when the media channel is ready to send the stream. Arguments are: |
1123 // writable(bool) | 1126 // writable(bool) |
1124 sigslot::signal1<bool> SignalReadyToSend; | 1127 sigslot::signal1<bool> SignalReadyToSend; |
1125 // Signal for notifying that the remote side has closed the DataChannel. | 1128 // Signal for notifying that the remote side has closed the DataChannel. |
1126 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; | 1129 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; |
1127 }; | 1130 }; |
1128 | 1131 |
1129 } // namespace cricket | 1132 } // namespace cricket |
1130 | 1133 |
1131 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ | 1134 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ |
OLD | NEW |