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 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. | 970 ERROR_PLAY_SRTP_AUTH_FAILED, // Failed to authenticate packets. |
959 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. | 971 ERROR_PLAY_SRTP_REPLAY, // Packet replay detected. |
960 }; | 972 }; |
961 | 973 |
962 VideoMediaChannel() {} | 974 VideoMediaChannel() {} |
963 VideoMediaChannel(const MediaConfig& config) : MediaChannel(config) {} | 975 VideoMediaChannel(const MediaConfig& config) : MediaChannel(config) {} |
964 virtual ~VideoMediaChannel() {} | 976 virtual ~VideoMediaChannel() {} |
965 | 977 |
966 virtual bool SetSendParameters(const VideoSendParameters& params) = 0; | 978 virtual bool SetSendParameters(const VideoSendParameters& params) = 0; |
967 virtual bool SetRecvParameters(const VideoRecvParameters& params) = 0; | 979 virtual bool SetRecvParameters(const VideoRecvParameters& params) = 0; |
| 980 virtual webrtc::RtpParameters GetRtpParameters(uint32_t ssrc) const = 0; |
| 981 virtual bool SetRtpParameters(uint32_t ssrc, |
| 982 const webrtc::RtpParameters& parameters) = 0; |
968 // Gets the currently set codecs/payload types to be used for outgoing media. | 983 // Gets the currently set codecs/payload types to be used for outgoing media. |
969 virtual bool GetSendCodec(VideoCodec* send_codec) = 0; | 984 virtual bool GetSendCodec(VideoCodec* send_codec) = 0; |
970 // Starts or stops transmission (and potentially capture) of local video. | 985 // Starts or stops transmission (and potentially capture) of local video. |
971 virtual bool SetSend(bool send) = 0; | 986 virtual bool SetSend(bool send) = 0; |
972 // Configure stream for sending. | 987 // Configure stream for sending. |
973 virtual bool SetVideoSend(uint32_t ssrc, | 988 virtual bool SetVideoSend(uint32_t ssrc, |
974 bool enable, | 989 bool enable, |
975 const VideoOptions* options) = 0; | 990 const VideoOptions* options) = 0; |
976 // Sets the sink object to be used for the specified stream. | 991 // Sets the sink object to be used for the specified stream. |
977 // If SSRC is 0, the renderer is used for the 'default' stream. | 992 // If SSRC is 0, the renderer is used for the 'default' stream. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 // Signal when the media channel is ready to send the stream. Arguments are: | 1120 // Signal when the media channel is ready to send the stream. Arguments are: |
1106 // writable(bool) | 1121 // writable(bool) |
1107 sigslot::signal1<bool> SignalReadyToSend; | 1122 sigslot::signal1<bool> SignalReadyToSend; |
1108 // Signal for notifying that the remote side has closed the DataChannel. | 1123 // Signal for notifying that the remote side has closed the DataChannel. |
1109 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; | 1124 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; |
1110 }; | 1125 }; |
1111 | 1126 |
1112 } // namespace cricket | 1127 } // namespace cricket |
1113 | 1128 |
1114 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ | 1129 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ |
OLD | NEW |