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 <memory> | 14 #include <memory> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
| 18 #include "webrtc/api/rtpparameters.h" |
18 #include "webrtc/base/basictypes.h" | 19 #include "webrtc/base/basictypes.h" |
19 #include "webrtc/base/buffer.h" | 20 #include "webrtc/base/buffer.h" |
20 #include "webrtc/base/dscp.h" | 21 #include "webrtc/base/dscp.h" |
21 #include "webrtc/base/logging.h" | 22 #include "webrtc/base/logging.h" |
22 #include "webrtc/base/optional.h" | 23 #include "webrtc/base/optional.h" |
23 #include "webrtc/base/sigslot.h" | 24 #include "webrtc/base/sigslot.h" |
24 #include "webrtc/base/socket.h" | 25 #include "webrtc/base/socket.h" |
25 #include "webrtc/base/window.h" | 26 #include "webrtc/base/window.h" |
26 #include "webrtc/media/base/codec.h" | 27 #include "webrtc/media/base/codec.h" |
27 #include "webrtc/media/base/mediaconstants.h" | 28 #include "webrtc/media/base/mediaconstants.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 for (size_t i = 0; i < vals.size(); ++i) { | 73 for (size_t i = 0; i < vals.size(); ++i) { |
73 if (i > 0) { | 74 if (i > 0) { |
74 ost << ", "; | 75 ost << ", "; |
75 } | 76 } |
76 ost << vals[i].ToString(); | 77 ost << vals[i].ToString(); |
77 } | 78 } |
78 ost << "]"; | 79 ost << "]"; |
79 return ost.str(); | 80 return ost.str(); |
80 } | 81 } |
81 | 82 |
| 83 template <typename T> |
| 84 static T MinPositive(T a, T b) { |
| 85 if (a <= 0) { |
| 86 return b; |
| 87 } |
| 88 if (b <= 0) { |
| 89 return a; |
| 90 } |
| 91 return std::min(a, b); |
| 92 } |
| 93 |
82 // Construction-time settings, passed to | 94 // Construction-time settings, passed to |
83 // MediaControllerInterface::Create, and passed on when creating | 95 // MediaControllerInterface::Create, and passed on when creating |
84 // MediaChannels. | 96 // MediaChannels. |
85 struct MediaConfig { | 97 struct MediaConfig { |
86 // Set DSCP value on packets. This flag comes from the | 98 // Set DSCP value on packets. This flag comes from the |
87 // PeerConnection constraint 'googDscp'. | 99 // PeerConnection constraint 'googDscp'. |
88 bool enable_dscp = false; | 100 bool enable_dscp = false; |
89 | 101 |
90 // Video-specific config. | 102 // Video-specific config. |
91 struct Video { | 103 struct Video { |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 980 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
969 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. | 981 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. |
970 }; | 982 }; |
971 | 983 |
972 VideoMediaChannel() {} | 984 VideoMediaChannel() {} |
973 VideoMediaChannel(const MediaConfig& config) : MediaChannel(config) {} | 985 VideoMediaChannel(const MediaConfig& config) : MediaChannel(config) {} |
974 virtual ~VideoMediaChannel() {} | 986 virtual ~VideoMediaChannel() {} |
975 | 987 |
976 virtual bool SetSendParameters(const VideoSendParameters& params) = 0; | 988 virtual bool SetSendParameters(const VideoSendParameters& params) = 0; |
977 virtual bool SetRecvParameters(const VideoRecvParameters& params) = 0; | 989 virtual bool SetRecvParameters(const VideoRecvParameters& params) = 0; |
| 990 virtual webrtc::RtpParameters GetRtpParameters(uint32_t ssrc) const = 0; |
| 991 virtual bool SetRtpParameters(uint32_t ssrc, |
| 992 const webrtc::RtpParameters& parameters) = 0; |
978 // Gets the currently set codecs/payload types to be used for outgoing media. | 993 // Gets the currently set codecs/payload types to be used for outgoing media. |
979 virtual bool GetSendCodec(VideoCodec* send_codec) = 0; | 994 virtual bool GetSendCodec(VideoCodec* send_codec) = 0; |
980 // Starts or stops transmission (and potentially capture) of local video. | 995 // Starts or stops transmission (and potentially capture) of local video. |
981 virtual bool SetSend(bool send) = 0; | 996 virtual bool SetSend(bool send) = 0; |
982 // Configure stream for sending. | 997 // Configure stream for sending. |
983 virtual bool SetVideoSend(uint32_t ssrc, | 998 virtual bool SetVideoSend(uint32_t ssrc, |
984 bool enable, | 999 bool enable, |
985 const VideoOptions* options) = 0; | 1000 const VideoOptions* options) = 0; |
986 // Sets the sink object to be used for the specified stream. | 1001 // Sets the sink object to be used for the specified stream. |
987 // If SSRC is 0, the renderer is used for the 'default' stream. | 1002 // If SSRC is 0, the renderer is used for the 'default' stream. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 // Signal when the media channel is ready to send the stream. Arguments are: | 1124 // Signal when the media channel is ready to send the stream. Arguments are: |
1110 // writable(bool) | 1125 // writable(bool) |
1111 sigslot::signal1<bool> SignalReadyToSend; | 1126 sigslot::signal1<bool> SignalReadyToSend; |
1112 // Signal for notifying that the remote side has closed the DataChannel. | 1127 // Signal for notifying that the remote side has closed the DataChannel. |
1113 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; | 1128 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; |
1114 }; | 1129 }; |
1115 | 1130 |
1116 } // namespace cricket | 1131 } // namespace cricket |
1117 | 1132 |
1118 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ | 1133 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ |
OLD | NEW |