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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // 5. Provide the local answer to the new PeerConnection by calling | 45 // 5. Provide the local answer to the new PeerConnection by calling |
46 // SetLocalSessionDescription with the answer. | 46 // SetLocalSessionDescription with the answer. |
47 // 6. Provide the remote ice candidates by calling AddIceCandidate. | 47 // 6. Provide the remote ice candidates by calling AddIceCandidate. |
48 // 7. Once a candidate have been found PeerConnection will call the observer | 48 // 7. Once a candidate have been found PeerConnection will call the observer |
49 // function OnIceCandidate. Send these candidates to the remote peer. | 49 // function OnIceCandidate. Send these candidates to the remote peer. |
50 | 50 |
51 #ifndef WEBRTC_API_PEERCONNECTIONINTERFACE_H_ | 51 #ifndef WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |
52 #define WEBRTC_API_PEERCONNECTIONINTERFACE_H_ | 52 #define WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |
53 | 53 |
54 #include <memory> | 54 #include <memory> |
| 55 #include <ostream> |
55 #include <string> | 56 #include <string> |
56 #include <utility> | 57 #include <utility> |
57 #include <vector> | 58 #include <vector> |
58 | 59 |
59 #include "webrtc/api/datachannelinterface.h" | 60 #include "webrtc/api/datachannelinterface.h" |
60 #include "webrtc/api/dtmfsenderinterface.h" | 61 #include "webrtc/api/dtmfsenderinterface.h" |
61 #include "webrtc/api/jsep.h" | 62 #include "webrtc/api/jsep.h" |
62 #include "webrtc/api/mediastreaminterface.h" | 63 #include "webrtc/api/mediastreaminterface.h" |
63 #include "webrtc/api/rtcstatscollector.h" | 64 #include "webrtc/api/rtcstatscollector.h" |
64 #include "webrtc/api/rtpreceiverinterface.h" | 65 #include "webrtc/api/rtpreceiverinterface.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 134 |
134 virtual void AddHistogramSample(PeerConnectionMetricsName type, | 135 virtual void AddHistogramSample(PeerConnectionMetricsName type, |
135 int value) = 0; | 136 int value) = 0; |
136 | 137 |
137 protected: | 138 protected: |
138 virtual ~MetricsObserverInterface() {} | 139 virtual ~MetricsObserverInterface() {} |
139 }; | 140 }; |
140 | 141 |
141 typedef MetricsObserverInterface UMAObserver; | 142 typedef MetricsObserverInterface UMAObserver; |
142 | 143 |
| 144 // Enumeration to represent distinct classes of errors that an application |
| 145 // may wish to act upon differently. These roughly map to DOMExceptions in |
| 146 // the web API, as described in the comments below. |
| 147 enum class RtcError { |
| 148 // No error. |
| 149 NONE, |
| 150 // A supplied parameter is valid, but currently unsupported. |
| 151 // Maps to InvalidAccessError DOMException. |
| 152 UNSUPPORTED_PARAMETER, |
| 153 // General error indicating that a supplied parameter is invalid. |
| 154 // Maps to InvalidAccessError or TypeError DOMException depending on context. |
| 155 INVALID_PARAMETER, |
| 156 // Slightly more specific than INVALID_PARAMETER; a parameter's value was |
| 157 // outside the allowed range. |
| 158 // Maps to RangeError DOMException. |
| 159 INVALID_RANGE, |
| 160 // Slightly more specific than INVALID_PARAMETER; an error occurred while |
| 161 // parsing string input. |
| 162 // Maps to SyntaxError DOMException. |
| 163 SYNTAX_ERROR, |
| 164 // The object does not support this operation in its current state. |
| 165 // Maps to InvalidStateError DOMException. |
| 166 INVALID_STATE, |
| 167 // An attempt was made to modify the object in an invalid way. |
| 168 // Maps to InvalidModificationError DOMException. |
| 169 INVALID_MODIFICATION, |
| 170 // An error occurred within an underlying network protocol. |
| 171 // Maps to NetworkError DOMException. |
| 172 NETWORK_ERROR, |
| 173 // The operation failed due to an internal error. |
| 174 // Maps to OperationError DOMException. |
| 175 INTERNAL_ERROR, |
| 176 }; |
| 177 |
| 178 // Outputs the error as a friendly string. |
| 179 // Update this method when adding a new error type. |
| 180 std::ostream& operator<<(std::ostream& stream, RtcError error); |
| 181 |
143 class PeerConnectionInterface : public rtc::RefCountInterface { | 182 class PeerConnectionInterface : public rtc::RefCountInterface { |
144 public: | 183 public: |
145 // See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions . | 184 // See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions . |
146 enum SignalingState { | 185 enum SignalingState { |
147 kStable, | 186 kStable, |
148 kHaveLocalOffer, | 187 kHaveLocalOffer, |
149 kHaveLocalPrAnswer, | 188 kHaveLocalPrAnswer, |
150 kHaveRemoteOffer, | 189 kHaveRemoteOffer, |
151 kHaveRemotePrAnswer, | 190 kHaveRemotePrAnswer, |
152 kClosed, | 191 kClosed, |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 808 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
770 cricket::WebRtcVideoDecoderFactory* decoder_factory) { | 809 cricket::WebRtcVideoDecoderFactory* decoder_factory) { |
771 return CreatePeerConnectionFactory( | 810 return CreatePeerConnectionFactory( |
772 worker_and_network_thread, worker_and_network_thread, signaling_thread, | 811 worker_and_network_thread, worker_and_network_thread, signaling_thread, |
773 default_adm, encoder_factory, decoder_factory); | 812 default_adm, encoder_factory, decoder_factory); |
774 } | 813 } |
775 | 814 |
776 } // namespace webrtc | 815 } // namespace webrtc |
777 | 816 |
778 #endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_ | 817 #endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |
OLD | NEW |