Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: webrtc/api/peerconnectioninterface.h

Issue 2692723002: Adding RTCErrorOr class to be used by ORTC APIs. (Closed)
Patch Set: Changing "CreateAndLogError" to a macro. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #include <ostream> 71 #include <ostream>
72 #include <string> 72 #include <string>
73 #include <utility> 73 #include <utility>
74 #include <vector> 74 #include <vector>
75 75
76 #include "webrtc/api/audio_codecs/audio_decoder_factory.h" 76 #include "webrtc/api/audio_codecs/audio_decoder_factory.h"
77 #include "webrtc/api/datachannelinterface.h" 77 #include "webrtc/api/datachannelinterface.h"
78 #include "webrtc/api/dtmfsenderinterface.h" 78 #include "webrtc/api/dtmfsenderinterface.h"
79 #include "webrtc/api/jsep.h" 79 #include "webrtc/api/jsep.h"
80 #include "webrtc/api/mediastreaminterface.h" 80 #include "webrtc/api/mediastreaminterface.h"
81 #include "webrtc/api/rtcerror.h"
81 #include "webrtc/api/rtpreceiverinterface.h" 82 #include "webrtc/api/rtpreceiverinterface.h"
82 #include "webrtc/api/rtpsenderinterface.h" 83 #include "webrtc/api/rtpsenderinterface.h"
83 #include "webrtc/api/stats/rtcstatscollectorcallback.h" 84 #include "webrtc/api/stats/rtcstatscollectorcallback.h"
84 #include "webrtc/api/statstypes.h" 85 #include "webrtc/api/statstypes.h"
85 #include "webrtc/api/umametrics.h" 86 #include "webrtc/api/umametrics.h"
86 #include "webrtc/base/fileutils.h" 87 #include "webrtc/base/fileutils.h"
87 #include "webrtc/base/network.h" 88 #include "webrtc/base/network.h"
88 #include "webrtc/base/rtccertificate.h" 89 #include "webrtc/base/rtccertificate.h"
89 #include "webrtc/base/rtccertificategenerator.h" 90 #include "webrtc/base/rtccertificategenerator.h"
90 #include "webrtc/base/socketaddress.h" 91 #include "webrtc/base/socketaddress.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 }; 127 };
127 128
128 class StatsObserver : public rtc::RefCountInterface { 129 class StatsObserver : public rtc::RefCountInterface {
129 public: 130 public:
130 virtual void OnComplete(const StatsReports& reports) = 0; 131 virtual void OnComplete(const StatsReports& reports) = 0;
131 132
132 protected: 133 protected:
133 virtual ~StatsObserver() {} 134 virtual ~StatsObserver() {}
134 }; 135 };
135 136
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 { 137 class PeerConnectionInterface : public rtc::RefCountInterface {
193 public: 138 public:
194 // See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions . 139 // See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions .
195 enum SignalingState { 140 enum SignalingState {
196 kStable, 141 kStable,
197 kHaveLocalOffer, 142 kHaveLocalOffer,
198 kHaveLocalPrAnswer, 143 kHaveLocalPrAnswer,
199 kHaveRemoteOffer, 144 kHaveRemoteOffer,
200 kHaveRemotePrAnswer, 145 kHaveRemotePrAnswer,
201 kClosed, 146 kClosed,
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 cricket::WebRtcVideoEncoderFactory* encoder_factory, 1101 cricket::WebRtcVideoEncoderFactory* encoder_factory,
1157 cricket::WebRtcVideoDecoderFactory* decoder_factory) { 1102 cricket::WebRtcVideoDecoderFactory* decoder_factory) {
1158 return CreatePeerConnectionFactory( 1103 return CreatePeerConnectionFactory(
1159 worker_and_network_thread, worker_and_network_thread, signaling_thread, 1104 worker_and_network_thread, worker_and_network_thread, signaling_thread,
1160 default_adm, encoder_factory, decoder_factory); 1105 default_adm, encoder_factory, decoder_factory);
1161 } 1106 }
1162 1107
1163 } // namespace webrtc 1108 } // namespace webrtc
1164 1109
1165 #endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_ 1110 #endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_
OLDNEW
« webrtc/api/BUILD.gn ('K') | « webrtc/api/BUILD.gn ('k') | webrtc/api/rtcerror.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698