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/api/rtpparameters.h" |
19 #include "webrtc/base/basictypes.h" | 19 #include "webrtc/base/basictypes.h" |
20 #include "webrtc/base/buffer.h" | 20 #include "webrtc/base/buffer.h" |
21 #include "webrtc/base/dscp.h" | 21 #include "webrtc/base/dscp.h" |
22 #include "webrtc/base/logging.h" | 22 #include "webrtc/base/logging.h" |
23 #include "webrtc/base/optional.h" | 23 #include "webrtc/base/optional.h" |
| 24 #include "webrtc/base/optional_ios.h" |
24 #include "webrtc/base/sigslot.h" | 25 #include "webrtc/base/sigslot.h" |
25 #include "webrtc/base/socket.h" | 26 #include "webrtc/base/socket.h" |
26 #include "webrtc/base/window.h" | 27 #include "webrtc/base/window.h" |
27 #include "webrtc/media/base/codec.h" | 28 #include "webrtc/media/base/codec.h" |
28 #include "webrtc/media/base/mediaconstants.h" | 29 #include "webrtc/media/base/mediaconstants.h" |
29 #include "webrtc/media/base/streamparams.h" | 30 #include "webrtc/media/base/streamparams.h" |
30 #include "webrtc/media/base/videosinkinterface.h" | 31 #include "webrtc/media/base/videosinkinterface.h" |
31 // TODO(juberti): re-evaluate this include | 32 // TODO(juberti): re-evaluate this include |
32 #include "webrtc/pc/audiomonitor.h" | 33 #include "webrtc/pc/audiomonitor.h" |
33 | 34 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 if (i > 0) { | 75 if (i > 0) { |
75 ost << ", "; | 76 ost << ", "; |
76 } | 77 } |
77 ost << vals[i].ToString(); | 78 ost << vals[i].ToString(); |
78 } | 79 } |
79 ost << "]"; | 80 ost << "]"; |
80 return ost.str(); | 81 return ost.str(); |
81 } | 82 } |
82 | 83 |
83 template <typename T> | 84 template <typename T> |
84 static T MinPositive(T a, T b) { | 85 static rtc::Optional<T> OptionalMin(rtc::Optional<T> a, rtc::Optional<T> b) { |
85 if (a <= 0) { | 86 if (!a) { |
86 return b; | 87 return b; |
87 } | 88 } |
88 if (b <= 0) { | 89 if (!b) { |
89 return a; | 90 return a; |
90 } | 91 } |
91 return std::min(a, b); | 92 |
| 93 return rtc::Optional<T>(std::min(*a, *b)); |
92 } | 94 } |
93 | 95 |
94 // Construction-time settings, passed to | 96 // Construction-time settings, passed to |
95 // MediaControllerInterface::Create, and passed on when creating | 97 // MediaControllerInterface::Create, and passed on when creating |
96 // MediaChannels. | 98 // MediaChannels. |
97 struct MediaConfig { | 99 struct MediaConfig { |
98 // Set DSCP value on packets. This flag comes from the | 100 // Set DSCP value on packets. This flag comes from the |
99 // PeerConnection constraint 'googDscp'. | 101 // PeerConnection constraint 'googDscp'. |
100 bool enable_dscp = false; | 102 bool enable_dscp = false; |
101 | 103 |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 RtcpParameters rtcp; | 839 RtcpParameters rtcp; |
838 }; | 840 }; |
839 | 841 |
840 template <class Codec> | 842 template <class Codec> |
841 struct RtpSendParameters : RtpParameters<Codec> { | 843 struct RtpSendParameters : RtpParameters<Codec> { |
842 std::string ToString() const override { | 844 std::string ToString() const override { |
843 std::ostringstream ost; | 845 std::ostringstream ost; |
844 ost << "{"; | 846 ost << "{"; |
845 ost << "codecs: " << VectorToString(this->codecs) << ", "; | 847 ost << "codecs: " << VectorToString(this->codecs) << ", "; |
846 ost << "extensions: " << VectorToString(this->extensions) << ", "; | 848 ost << "extensions: " << VectorToString(this->extensions) << ", "; |
847 ost << "max_bandwidth_bps: " << max_bandwidth_bps << ", "; | 849 ost << "max_bitrate_bps: " << max_bitrate_bps << ", "; |
848 ost << "}"; | 850 ost << "}"; |
849 return ost.str(); | 851 return ost.str(); |
850 } | 852 } |
851 | 853 |
852 int max_bandwidth_bps = -1; | 854 rtc::Optional<int> max_bitrate_bps; |
853 }; | 855 }; |
854 | 856 |
855 struct AudioSendParameters : RtpSendParameters<AudioCodec> { | 857 struct AudioSendParameters : RtpSendParameters<AudioCodec> { |
856 std::string ToString() const override { | 858 std::string ToString() const override { |
857 std::ostringstream ost; | 859 std::ostringstream ost; |
858 ost << "{"; | 860 ost << "{"; |
859 ost << "codecs: " << VectorToString(this->codecs) << ", "; | 861 ost << "codecs: " << VectorToString(this->codecs) << ", "; |
860 ost << "extensions: " << VectorToString(this->extensions) << ", "; | 862 ost << "extensions: " << VectorToString(this->extensions) << ", "; |
861 ost << "max_bandwidth_bps: " << max_bandwidth_bps << ", "; | 863 ost << "max_bitrate_bps: " << max_bitrate_bps << ", "; |
862 ost << "options: " << options.ToString(); | 864 ost << "options: " << options.ToString(); |
863 ost << "}"; | 865 ost << "}"; |
864 return ost.str(); | 866 return ost.str(); |
865 } | 867 } |
866 | 868 |
867 AudioOptions options; | 869 AudioOptions options; |
868 }; | 870 }; |
869 | 871 |
870 struct AudioRecvParameters : RtpParameters<AudioCodec> { | 872 struct AudioRecvParameters : RtpParameters<AudioCodec> { |
871 }; | 873 }; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 }; | 1059 }; |
1058 | 1060 |
1059 enum SendDataResult { SDR_SUCCESS, SDR_ERROR, SDR_BLOCK }; | 1061 enum SendDataResult { SDR_SUCCESS, SDR_ERROR, SDR_BLOCK }; |
1060 | 1062 |
1061 struct DataSendParameters : RtpSendParameters<DataCodec> { | 1063 struct DataSendParameters : RtpSendParameters<DataCodec> { |
1062 std::string ToString() const { | 1064 std::string ToString() const { |
1063 std::ostringstream ost; | 1065 std::ostringstream ost; |
1064 // Options and extensions aren't used. | 1066 // Options and extensions aren't used. |
1065 ost << "{"; | 1067 ost << "{"; |
1066 ost << "codecs: " << VectorToString(codecs) << ", "; | 1068 ost << "codecs: " << VectorToString(codecs) << ", "; |
1067 ost << "max_bandwidth_bps: " << max_bandwidth_bps; | 1069 ost << "max_bitrate_bps: " << max_bitrate_bps; |
1068 ost << "}"; | 1070 ost << "}"; |
1069 return ost.str(); | 1071 return ost.str(); |
1070 } | 1072 } |
1071 }; | 1073 }; |
1072 | 1074 |
1073 struct DataRecvParameters : RtpParameters<DataCodec> { | 1075 struct DataRecvParameters : RtpParameters<DataCodec> { |
1074 }; | 1076 }; |
1075 | 1077 |
1076 class DataMediaChannel : public MediaChannel { | 1078 class DataMediaChannel : public MediaChannel { |
1077 public: | 1079 public: |
(...skipping 29 matching lines...) Expand all Loading... |
1107 // Signal when the media channel is ready to send the stream. Arguments are: | 1109 // Signal when the media channel is ready to send the stream. Arguments are: |
1108 // writable(bool) | 1110 // writable(bool) |
1109 sigslot::signal1<bool> SignalReadyToSend; | 1111 sigslot::signal1<bool> SignalReadyToSend; |
1110 // Signal for notifying that the remote side has closed the DataChannel. | 1112 // Signal for notifying that the remote side has closed the DataChannel. |
1111 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; | 1113 sigslot::signal1<uint32_t> SignalStreamClosedRemotely; |
1112 }; | 1114 }; |
1113 | 1115 |
1114 } // namespace cricket | 1116 } // namespace cricket |
1115 | 1117 |
1116 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ | 1118 #endif // WEBRTC_MEDIA_BASE_MEDIACHANNEL_H_ |
OLD | NEW |