| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 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 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // | 61 // |
| 62 // 6. Provide the remote ICE candidates by calling AddIceCandidate. | 62 // 6. Provide the remote ICE candidates by calling AddIceCandidate. |
| 63 // | 63 // |
| 64 // 7. Once a candidate has been gathered, the PeerConnection will call the | 64 // 7. Once a candidate has been gathered, the PeerConnection will call the |
| 65 // observer function OnIceCandidate. Send these candidates to the remote peer. | 65 // observer function OnIceCandidate. Send these candidates to the remote peer. |
| 66 | 66 |
| 67 #ifndef WEBRTC_API_PEERCONNECTIONINTERFACE_H_ | 67 #ifndef WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |
| 68 #define WEBRTC_API_PEERCONNECTIONINTERFACE_H_ | 68 #define WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |
| 69 | 69 |
| 70 #include <memory> | 70 #include <memory> |
| 71 #include <ostream> | |
| 72 #include <string> | 71 #include <string> |
| 73 #include <utility> | 72 #include <utility> |
| 74 #include <vector> | 73 #include <vector> |
| 75 | 74 |
| 76 #include "webrtc/api/datachannelinterface.h" | 75 #include "webrtc/api/datachannelinterface.h" |
| 77 #include "webrtc/api/dtmfsenderinterface.h" | 76 #include "webrtc/api/dtmfsenderinterface.h" |
| 78 #include "webrtc/api/jsep.h" | 77 #include "webrtc/api/jsep.h" |
| 79 #include "webrtc/api/mediastreaminterface.h" | 78 #include "webrtc/api/mediastreaminterface.h" |
| 80 #include "webrtc/api/stats/rtcstatscollectorcallback.h" | 79 #include "webrtc/api/stats/rtcstatscollectorcallback.h" |
| 80 #include "webrtc/api/rtcerror.h" |
| 81 #include "webrtc/api/rtpreceiverinterface.h" | 81 #include "webrtc/api/rtpreceiverinterface.h" |
| 82 #include "webrtc/api/rtpsenderinterface.h" | 82 #include "webrtc/api/rtpsenderinterface.h" |
| 83 #include "webrtc/api/statstypes.h" | 83 #include "webrtc/api/statstypes.h" |
| 84 #include "webrtc/api/umametrics.h" | 84 #include "webrtc/api/umametrics.h" |
| 85 #include "webrtc/base/fileutils.h" | 85 #include "webrtc/base/fileutils.h" |
| 86 #include "webrtc/base/network.h" | 86 #include "webrtc/base/network.h" |
| 87 #include "webrtc/base/rtccertificate.h" | 87 #include "webrtc/base/rtccertificate.h" |
| 88 #include "webrtc/base/rtccertificategenerator.h" | 88 #include "webrtc/base/rtccertificategenerator.h" |
| 89 #include "webrtc/base/socketaddress.h" | 89 #include "webrtc/base/socketaddress.h" |
| 90 #include "webrtc/base/sslstreamadapter.h" | 90 #include "webrtc/base/sslstreamadapter.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 class StatsObserver : public rtc::RefCountInterface { | 128 class StatsObserver : public rtc::RefCountInterface { |
| 129 public: | 129 public: |
| 130 virtual void OnComplete(const StatsReports& reports) = 0; | 130 virtual void OnComplete(const StatsReports& reports) = 0; |
| 131 | 131 |
| 132 protected: | 132 protected: |
| 133 virtual ~StatsObserver() {} | 133 virtual ~StatsObserver() {} |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 // Enumeration to represent distinct classes of errors that an application | |
| 137 // may wish to act upon differently. These roughly map to DOMExceptions or | |
| 138 // RTCError "errorDetailEnum" values in the web API, as described in the | |
| 139 // comments below. | |
| 140 enum class RTCErrorType { | |
| 141 // No error. | |
| 142 NONE, | |
| 143 // A supplied parameter is valid, but currently unsupported. | |
| 144 // Maps to InvalidAccessError DOMException. | |
| 145 UNSUPPORTED_PARAMETER, | |
| 146 // General error indicating that a supplied parameter is invalid. | |
| 147 // Maps to InvalidAccessError or TypeError DOMException depending on context. | |
| 148 INVALID_PARAMETER, | |
| 149 // Slightly more specific than INVALID_PARAMETER; a parameter's value was | |
| 150 // outside the allowed range. | |
| 151 // Maps to RangeError DOMException. | |
| 152 INVALID_RANGE, | |
| 153 // Slightly more specific than INVALID_PARAMETER; an error occurred while | |
| 154 // parsing string input. | |
| 155 // Maps to SyntaxError DOMException. | |
| 156 SYNTAX_ERROR, | |
| 157 // The object does not support this operation in its current state. | |
| 158 // Maps to InvalidStateError DOMException. | |
| 159 INVALID_STATE, | |
| 160 // An attempt was made to modify the object in an invalid way. | |
| 161 // Maps to InvalidModificationError DOMException. | |
| 162 INVALID_MODIFICATION, | |
| 163 // An error occurred within an underlying network protocol. | |
| 164 // Maps to NetworkError DOMException. | |
| 165 NETWORK_ERROR, | |
| 166 // The operation failed due to an internal error. | |
| 167 // Maps to OperationError DOMException. | |
| 168 INTERNAL_ERROR, | |
| 169 }; | |
| 170 | |
| 171 // Roughly corresponds to RTCError in the web api. Holds an error type and | |
| 172 // possibly additional information specific to that error. | |
| 173 // | |
| 174 // Doesn't contain anything beyond a type now, but will in the future as more | |
| 175 // errors are implemented. | |
| 176 class RTCError { | |
| 177 public: | |
| 178 RTCError() : type_(RTCErrorType::NONE) {} | |
| 179 explicit RTCError(RTCErrorType type) : type_(type) {} | |
| 180 | |
| 181 RTCErrorType type() const { return type_; } | |
| 182 void set_type(RTCErrorType type) { type_ = type; } | |
| 183 | |
| 184 private: | |
| 185 RTCErrorType type_; | |
| 186 }; | |
| 187 | |
| 188 // Outputs the error as a friendly string. | |
| 189 // Update this method when adding a new error type. | |
| 190 std::ostream& operator<<(std::ostream& stream, RTCErrorType error); | |
| 191 | |
| 192 class PeerConnectionInterface : public rtc::RefCountInterface { | 136 class PeerConnectionInterface : public rtc::RefCountInterface { |
| 193 public: | 137 public: |
| 194 // See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions . | 138 // See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions . |
| 195 enum SignalingState { | 139 enum SignalingState { |
| 196 kStable, | 140 kStable, |
| 197 kHaveLocalOffer, | 141 kHaveLocalOffer, |
| 198 kHaveLocalPrAnswer, | 142 kHaveLocalPrAnswer, |
| 199 kHaveRemoteOffer, | 143 kHaveRemoteOffer, |
| 200 kHaveRemotePrAnswer, | 144 kHaveRemotePrAnswer, |
| 201 kClosed, | 145 kClosed, |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 1095 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 1152 cricket::WebRtcVideoDecoderFactory* decoder_factory) { | 1096 cricket::WebRtcVideoDecoderFactory* decoder_factory) { |
| 1153 return CreatePeerConnectionFactory( | 1097 return CreatePeerConnectionFactory( |
| 1154 worker_and_network_thread, worker_and_network_thread, signaling_thread, | 1098 worker_and_network_thread, worker_and_network_thread, signaling_thread, |
| 1155 default_adm, encoder_factory, decoder_factory); | 1099 default_adm, encoder_factory, decoder_factory); |
| 1156 } | 1100 } |
| 1157 | 1101 |
| 1158 } // namespace webrtc | 1102 } // namespace webrtc |
| 1159 | 1103 |
| 1160 #endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_ | 1104 #endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |
| OLD | NEW |