| 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> | |
| 56 #include <string> | 55 #include <string> |
| 57 #include <utility> | 56 #include <utility> |
| 58 #include <vector> | 57 #include <vector> |
| 59 | 58 |
| 60 #include "webrtc/api/datachannelinterface.h" | 59 #include "webrtc/api/datachannelinterface.h" |
| 61 #include "webrtc/api/dtmfsenderinterface.h" | 60 #include "webrtc/api/dtmfsenderinterface.h" |
| 62 #include "webrtc/api/jsep.h" | 61 #include "webrtc/api/jsep.h" |
| 63 #include "webrtc/api/mediastreaminterface.h" | 62 #include "webrtc/api/mediastreaminterface.h" |
| 64 #include "webrtc/api/stats/rtcstatscollectorcallback.h" | 63 #include "webrtc/api/stats/rtcstatscollectorcallback.h" |
| 64 #include "webrtc/api/rtcerror.h" |
| 65 #include "webrtc/api/rtpreceiverinterface.h" | 65 #include "webrtc/api/rtpreceiverinterface.h" |
| 66 #include "webrtc/api/rtpsenderinterface.h" | 66 #include "webrtc/api/rtpsenderinterface.h" |
| 67 #include "webrtc/api/statstypes.h" | 67 #include "webrtc/api/statstypes.h" |
| 68 #include "webrtc/api/umametrics.h" | 68 #include "webrtc/api/umametrics.h" |
| 69 #include "webrtc/base/fileutils.h" | 69 #include "webrtc/base/fileutils.h" |
| 70 #include "webrtc/base/network.h" | 70 #include "webrtc/base/network.h" |
| 71 #include "webrtc/base/rtccertificate.h" | 71 #include "webrtc/base/rtccertificate.h" |
| 72 #include "webrtc/base/rtccertificategenerator.h" | 72 #include "webrtc/base/rtccertificategenerator.h" |
| 73 #include "webrtc/base/socketaddress.h" | 73 #include "webrtc/base/socketaddress.h" |
| 74 #include "webrtc/base/sslstreamadapter.h" | 74 #include "webrtc/base/sslstreamadapter.h" |
| 75 #include "webrtc/media/base/mediachannel.h" | 75 #include "webrtc/media/base/mediachannel.h" |
| 76 #include "webrtc/media/base/videocapturer.h" |
| 76 #include "webrtc/p2p/base/portallocator.h" | 77 #include "webrtc/p2p/base/portallocator.h" |
| 77 | 78 |
| 78 namespace rtc { | 79 namespace rtc { |
| 79 class SSLIdentity; | 80 class SSLIdentity; |
| 80 class Thread; | 81 class Thread; |
| 81 } | 82 } |
| 82 | 83 |
| 83 namespace cricket { | 84 namespace cricket { |
| 84 class WebRtcVideoDecoderFactory; | 85 class WebRtcVideoDecoderFactory; |
| 85 class WebRtcVideoEncoderFactory; | 86 class WebRtcVideoEncoderFactory; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 108 }; | 109 }; |
| 109 | 110 |
| 110 class StatsObserver : public rtc::RefCountInterface { | 111 class StatsObserver : public rtc::RefCountInterface { |
| 111 public: | 112 public: |
| 112 virtual void OnComplete(const StatsReports& reports) = 0; | 113 virtual void OnComplete(const StatsReports& reports) = 0; |
| 113 | 114 |
| 114 protected: | 115 protected: |
| 115 virtual ~StatsObserver() {} | 116 virtual ~StatsObserver() {} |
| 116 }; | 117 }; |
| 117 | 118 |
| 118 // Enumeration to represent distinct classes of errors that an application | |
| 119 // may wish to act upon differently. These roughly map to DOMExceptions or | |
| 120 // RTCError "errorDetailEnum" values in the web API, as described in the | |
| 121 // comments below. | |
| 122 enum class RTCErrorType { | |
| 123 // No error. | |
| 124 NONE, | |
| 125 // A supplied parameter is valid, but currently unsupported. | |
| 126 // Maps to InvalidAccessError DOMException. | |
| 127 UNSUPPORTED_PARAMETER, | |
| 128 // General error indicating that a supplied parameter is invalid. | |
| 129 // Maps to InvalidAccessError or TypeError DOMException depending on context. | |
| 130 INVALID_PARAMETER, | |
| 131 // Slightly more specific than INVALID_PARAMETER; a parameter's value was | |
| 132 // outside the allowed range. | |
| 133 // Maps to RangeError DOMException. | |
| 134 INVALID_RANGE, | |
| 135 // Slightly more specific than INVALID_PARAMETER; an error occurred while | |
| 136 // parsing string input. | |
| 137 // Maps to SyntaxError DOMException. | |
| 138 SYNTAX_ERROR, | |
| 139 // The object does not support this operation in its current state. | |
| 140 // Maps to InvalidStateError DOMException. | |
| 141 INVALID_STATE, | |
| 142 // An attempt was made to modify the object in an invalid way. | |
| 143 // Maps to InvalidModificationError DOMException. | |
| 144 INVALID_MODIFICATION, | |
| 145 // An error occurred within an underlying network protocol. | |
| 146 // Maps to NetworkError DOMException. | |
| 147 NETWORK_ERROR, | |
| 148 // The operation failed due to an internal error. | |
| 149 // Maps to OperationError DOMException. | |
| 150 INTERNAL_ERROR, | |
| 151 }; | |
| 152 | |
| 153 // Roughly corresponds to RTCError in the web api. Holds an error type and | |
| 154 // possibly additional information specific to that error. | |
| 155 // | |
| 156 // Doesn't contain anything beyond a type now, but will in the future as more | |
| 157 // errors are implemented. | |
| 158 class RTCError { | |
| 159 public: | |
| 160 RTCError() : type_(RTCErrorType::NONE) {} | |
| 161 explicit RTCError(RTCErrorType type) : type_(type) {} | |
| 162 | |
| 163 RTCErrorType type() const { return type_; } | |
| 164 void set_type(RTCErrorType type) { type_ = type; } | |
| 165 | |
| 166 private: | |
| 167 RTCErrorType type_; | |
| 168 }; | |
| 169 | |
| 170 // Outputs the error as a friendly string. | |
| 171 // Update this method when adding a new error type. | |
| 172 std::ostream& operator<<(std::ostream& stream, RTCErrorType error); | |
| 173 | |
| 174 class PeerConnectionInterface : public rtc::RefCountInterface { | 119 class PeerConnectionInterface : public rtc::RefCountInterface { |
| 175 public: | 120 public: |
| 176 // See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions . | 121 // See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions . |
| 177 enum SignalingState { | 122 enum SignalingState { |
| 178 kStable, | 123 kStable, |
| 179 kHaveLocalOffer, | 124 kHaveLocalOffer, |
| 180 kHaveLocalPrAnswer, | 125 kHaveLocalPrAnswer, |
| 181 kHaveRemoteOffer, | 126 kHaveRemoteOffer, |
| 182 kHaveRemotePrAnswer, | 127 kHaveRemotePrAnswer, |
| 183 kClosed, | 128 kClosed, |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 827 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 883 cricket::WebRtcVideoDecoderFactory* decoder_factory) { | 828 cricket::WebRtcVideoDecoderFactory* decoder_factory) { |
| 884 return CreatePeerConnectionFactory( | 829 return CreatePeerConnectionFactory( |
| 885 worker_and_network_thread, worker_and_network_thread, signaling_thread, | 830 worker_and_network_thread, worker_and_network_thread, signaling_thread, |
| 886 default_adm, encoder_factory, decoder_factory); | 831 default_adm, encoder_factory, decoder_factory); |
| 887 } | 832 } |
| 888 | 833 |
| 889 } // namespace webrtc | 834 } // namespace webrtc |
| 890 | 835 |
| 891 #endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_ | 836 #endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_ |
| OLD | NEW |