media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h

branch
TOR_BUG_9701
changeset 10
ac0c01689b40
equal deleted inserted replaced
-1:000000000000 0:4739356f8014
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #ifndef _PEER_CONNECTION_IMPL_H_
6 #define _PEER_CONNECTION_IMPL_H_
7
8 #include <deque>
9 #include <string>
10 #include <vector>
11 #include <map>
12 #include <cmath>
13
14 #include "prlock.h"
15 #include "mozilla/RefPtr.h"
16 #include "nsWeakPtr.h"
17 #include "nsAutoPtr.h"
18 #include "nsIWeakReferenceUtils.h" // for the definition of nsWeakPtr
19 #include "IPeerConnection.h"
20 #include "sigslot.h"
21 #include "nricectx.h"
22 #include "nricemediastream.h"
23 #include "nsComponentManagerUtils.h"
24 #include "nsPIDOMWindow.h"
25 #include "nsIThread.h"
26
27 #include "mozilla/ErrorResult.h"
28 #include "mozilla/dom/PeerConnectionImplEnumsBinding.h"
29 #include "StreamBuffer.h"
30 #include "LoadManagerFactory.h"
31
32 #ifdef MOZILLA_INTERNAL_API
33 #include "mozilla/TimeStamp.h"
34 #include "mozilla/net/DataChannel.h"
35 #include "VideoUtils.h"
36 #include "VideoSegment.h"
37 #include "nsNSSShutDown.h"
38 #include "mozilla/dom/RTCStatsReportBinding.h"
39 #endif
40
41 namespace test {
42 #ifdef USE_FAKE_PCOBSERVER
43 class AFakePCObserver;
44 #endif
45 }
46
47 #ifdef USE_FAKE_MEDIA_STREAMS
48 class Fake_DOMMediaStream;
49 #endif
50
51 class nsGlobalWindow;
52 class nsIDOMMediaStream;
53 class nsDOMDataChannel;
54
55 namespace mozilla {
56 class DataChannel;
57 class DtlsIdentity;
58 class NrIceCtx;
59 class NrIceMediaStream;
60 class NrIceStunServer;
61 class NrIceTurnServer;
62 class MediaPipeline;
63
64 #ifdef USE_FAKE_MEDIA_STREAMS
65 typedef Fake_DOMMediaStream DOMMediaStream;
66 #else
67 class DOMMediaStream;
68 #endif
69
70 namespace dom {
71 class RTCConfiguration;
72 class MediaConstraintsInternal;
73 class MediaStreamTrack;
74 class RTCStatsReportInternal;
75
76 #ifdef USE_FAKE_PCOBSERVER
77 typedef test::AFakePCObserver PeerConnectionObserver;
78 typedef const char *PCObserverString;
79 #else
80 class PeerConnectionObserver;
81 typedef NS_ConvertUTF8toUTF16 PCObserverString;
82 #endif
83 }
84 class MediaConstraintsExternal;
85 }
86
87 #if defined(__cplusplus) && __cplusplus >= 201103L
88 typedef struct Timecard Timecard;
89 #else
90 #include "timecard.h"
91 #endif
92
93 // To preserve blame, convert nsresult to ErrorResult with wrappers. These macros
94 // help declare wrappers w/function being wrapped when there are no differences.
95
96 #define NS_IMETHODIMP_TO_ERRORRESULT(func, rv, ...) \
97 NS_IMETHODIMP func(__VA_ARGS__); \
98 void func (__VA_ARGS__, rv)
99
100 #define NS_IMETHODIMP_TO_ERRORRESULT_RETREF(resulttype, func, rv, ...) \
101 NS_IMETHODIMP func(__VA_ARGS__, resulttype **result); \
102 already_AddRefed<resulttype> func (__VA_ARGS__, rv)
103
104 namespace sipcc {
105
106 using mozilla::dom::PeerConnectionObserver;
107 using mozilla::dom::RTCConfiguration;
108 using mozilla::dom::MediaConstraintsInternal;
109 using mozilla::MediaConstraintsExternal;
110 using mozilla::DOMMediaStream;
111 using mozilla::NrIceCtx;
112 using mozilla::NrIceMediaStream;
113 using mozilla::DtlsIdentity;
114 using mozilla::ErrorResult;
115 using mozilla::NrIceStunServer;
116 using mozilla::NrIceTurnServer;
117
118 class PeerConnectionWrapper;
119 class PeerConnectionMedia;
120 class RemoteSourceStreamInfo;
121 class OnCallEventArgs;
122
123 class IceConfiguration
124 {
125 public:
126 bool addStunServer(const std::string& addr, uint16_t port)
127 {
128 NrIceStunServer* server(NrIceStunServer::Create(addr, port));
129 if (!server) {
130 return false;
131 }
132 addStunServer(*server);
133 return true;
134 }
135 bool addTurnServer(const std::string& addr, uint16_t port,
136 const std::string& username,
137 const std::string& pwd,
138 const char* transport)
139 {
140 // TODO(ekr@rtfm.com): Need support for SASLprep for
141 // username and password. Bug # ???
142 std::vector<unsigned char> password(pwd.begin(), pwd.end());
143
144 NrIceTurnServer* server(NrIceTurnServer::Create(addr, port, username, password,
145 transport));
146 if (!server) {
147 return false;
148 }
149 addTurnServer(*server);
150 return true;
151 }
152 void addStunServer(const NrIceStunServer& server) { mStunServers.push_back (server); }
153 void addTurnServer(const NrIceTurnServer& server) { mTurnServers.push_back (server); }
154 const std::vector<NrIceStunServer>& getStunServers() const { return mStunServers; }
155 const std::vector<NrIceTurnServer>& getTurnServers() const { return mTurnServers; }
156 private:
157 std::vector<NrIceStunServer> mStunServers;
158 std::vector<NrIceTurnServer> mTurnServers;
159 };
160
161 #ifdef MOZILLA_INTERNAL_API
162 // Not an inner class so we can forward declare.
163 class RTCStatsQuery {
164 public:
165 explicit RTCStatsQuery(bool internalStats);
166 ~RTCStatsQuery();
167
168 mozilla::dom::RTCStatsReportInternal report;
169 std::string error;
170
171 private:
172 friend class PeerConnectionImpl;
173 std::string pcName;
174 bool internalStats;
175 nsTArray<mozilla::RefPtr<mozilla::MediaPipeline>> pipelines;
176 mozilla::RefPtr<NrIceCtx> iceCtx;
177 nsTArray<mozilla::RefPtr<NrIceMediaStream>> streams;
178 DOMHighResTimeStamp now;
179 };
180 #endif // MOZILLA_INTERNAL_API
181
182 // Enter an API call and check that the state is OK,
183 // the PC isn't closed, etc.
184 #define PC_AUTO_ENTER_API_CALL(assert_ice_ready) \
185 do { \
186 /* do/while prevents res from conflicting with locals */ \
187 nsresult res = CheckApiState(assert_ice_ready); \
188 if (NS_FAILED(res)) return res; \
189 } while(0)
190 #define PC_AUTO_ENTER_API_CALL_VOID_RETURN(assert_ice_ready) \
191 do { \
192 /* do/while prevents res from conflicting with locals */ \
193 nsresult res = CheckApiState(assert_ice_ready); \
194 if (NS_FAILED(res)) return; \
195 } while(0)
196 #define PC_AUTO_ENTER_API_CALL_NO_CHECK() CheckThread()
197
198 class PeerConnectionImpl MOZ_FINAL : public nsISupports,
199 #ifdef MOZILLA_INTERNAL_API
200 public mozilla::DataChannelConnection::DataConnectionListener,
201 public nsNSSShutDownObject,
202 #endif
203 public sigslot::has_slots<>
204 {
205 class Internal; // Avoid exposing c includes to bindings
206
207 public:
208 PeerConnectionImpl(const mozilla::dom::GlobalObject* aGlobal = nullptr);
209 virtual ~PeerConnectionImpl();
210
211 enum Error {
212 kNoError = 0,
213 kInvalidConstraintsType = 1,
214 kInvalidCandidateType = 2,
215 kInvalidMediastreamTrack = 3,
216 kInvalidState = 4,
217 kInvalidSessionDescription = 5,
218 kIncompatibleSessionDescription = 6,
219 kIncompatibleConstraints = 7,
220 kIncompatibleMediaStreamTrack = 8,
221 kInternalError = 9
222 };
223
224 NS_DECL_THREADSAFE_ISUPPORTS
225
226 #ifdef MOZILLA_INTERNAL_API
227 virtual JSObject* WrapObject(JSContext* cx);
228 #endif
229
230 static already_AddRefed<PeerConnectionImpl>
231 Constructor(const mozilla::dom::GlobalObject& aGlobal, ErrorResult& rv);
232 static PeerConnectionImpl* CreatePeerConnection();
233 static nsresult ConvertRTCConfiguration(const RTCConfiguration& aSrc,
234 IceConfiguration *aDst);
235 static already_AddRefed<DOMMediaStream> MakeMediaStream(nsPIDOMWindow* aWindow,
236 uint32_t aHint);
237
238 nsresult CreateRemoteSourceStreamInfo(nsRefPtr<RemoteSourceStreamInfo>* aInfo);
239
240 // Implementation of the only observer we need
241 void onCallEvent(const OnCallEventArgs &args);
242
243 // DataConnection observers
244 void NotifyConnection();
245 void NotifyClosedConnection();
246 void NotifyDataChannel(already_AddRefed<mozilla::DataChannel> aChannel);
247
248 // Get the media object
249 const nsRefPtr<PeerConnectionMedia>& media() const {
250 PC_AUTO_ENTER_API_CALL_NO_CHECK();
251 return mMedia;
252 }
253
254 mozilla::LoadManager* load_manager() {
255 return mLoadManager;
256 }
257
258 // Handle system to allow weak references to be passed through C code
259 virtual const std::string& GetHandle();
260
261 // Name suitable for exposing to content
262 virtual const std::string& GetName();
263
264 // ICE events
265 void IceConnectionStateChange(NrIceCtx* ctx,
266 NrIceCtx::ConnectionState state);
267 void IceGatheringStateChange(NrIceCtx* ctx,
268 NrIceCtx::GatheringState state);
269 void IceStreamReady(NrIceMediaStream *aStream);
270
271 static void ListenThread(void *aData);
272 static void ConnectThread(void *aData);
273
274 // Get the main thread
275 nsCOMPtr<nsIThread> GetMainThread() {
276 PC_AUTO_ENTER_API_CALL_NO_CHECK();
277 return mThread;
278 }
279
280 // Get the STS thread
281 nsCOMPtr<nsIEventTarget> GetSTSThread() {
282 PC_AUTO_ENTER_API_CALL_NO_CHECK();
283 return mSTSThread;
284 }
285
286 // Get the DTLS identity
287 mozilla::RefPtr<DtlsIdentity> const GetIdentity() const;
288 std::string GetFingerprint() const;
289 std::string GetFingerprintAlgorithm() const;
290 std::string GetFingerprintHexValue() const;
291
292 // Create a fake media stream
293 nsresult CreateFakeMediaStream(uint32_t hint, nsIDOMMediaStream** retval);
294
295 nsPIDOMWindow* GetWindow() const {
296 PC_AUTO_ENTER_API_CALL_NO_CHECK();
297 return mWindow;
298 }
299
300 // Initialize PeerConnection from an IceConfiguration object (unit-tests)
301 nsresult Initialize(PeerConnectionObserver& aObserver,
302 nsGlobalWindow* aWindow,
303 const IceConfiguration& aConfiguration,
304 nsIThread* aThread) {
305 return Initialize(aObserver, aWindow, &aConfiguration, nullptr, aThread);
306 }
307
308 // Initialize PeerConnection from an RTCConfiguration object (JS entrypoint)
309 void Initialize(PeerConnectionObserver& aObserver,
310 nsGlobalWindow& aWindow,
311 const RTCConfiguration& aConfiguration,
312 nsISupports* aThread,
313 ErrorResult &rv)
314 {
315 nsresult r = Initialize(aObserver, &aWindow, nullptr, &aConfiguration, aThread);
316 if (NS_FAILED(r)) {
317 rv.Throw(r);
318 }
319 }
320
321 NS_IMETHODIMP_TO_ERRORRESULT(CreateOffer, ErrorResult &rv,
322 const MediaConstraintsInternal& aConstraints)
323 {
324 rv = CreateOffer(aConstraints);
325 }
326
327 NS_IMETHODIMP_TO_ERRORRESULT(CreateAnswer, ErrorResult &rv,
328 const MediaConstraintsInternal& aConstraints)
329 {
330 rv = CreateAnswer(aConstraints);
331 }
332
333 NS_IMETHODIMP CreateOffer(const MediaConstraintsExternal& aConstraints);
334 NS_IMETHODIMP CreateAnswer(const MediaConstraintsExternal& aConstraints);
335
336 NS_IMETHODIMP SetLocalDescription (int32_t aAction, const char* aSDP);
337
338 void SetLocalDescription (int32_t aAction, const nsAString& aSDP, ErrorResult &rv)
339 {
340 rv = SetLocalDescription(aAction, NS_ConvertUTF16toUTF8(aSDP).get());
341 }
342
343 NS_IMETHODIMP SetRemoteDescription (int32_t aAction, const char* aSDP);
344
345 void SetRemoteDescription (int32_t aAction, const nsAString& aSDP, ErrorResult &rv)
346 {
347 rv = SetRemoteDescription(aAction, NS_ConvertUTF16toUTF8(aSDP).get());
348 }
349
350 NS_IMETHODIMP_TO_ERRORRESULT(GetStats, ErrorResult &rv,
351 mozilla::dom::MediaStreamTrack *aSelector)
352 {
353 rv = GetStats(aSelector);
354 }
355
356 NS_IMETHODIMP AddIceCandidate(const char* aCandidate, const char* aMid,
357 unsigned short aLevel);
358
359 void AddIceCandidate(const nsAString& aCandidate, const nsAString& aMid,
360 unsigned short aLevel, ErrorResult &rv)
361 {
362 rv = AddIceCandidate(NS_ConvertUTF16toUTF8(aCandidate).get(),
363 NS_ConvertUTF16toUTF8(aMid).get(), aLevel);
364 }
365
366 NS_IMETHODIMP CloseStreams();
367
368 void CloseStreams(ErrorResult &rv)
369 {
370 rv = CloseStreams();
371 }
372
373 NS_IMETHODIMP_TO_ERRORRESULT(AddStream, ErrorResult &rv,
374 DOMMediaStream& aMediaStream,
375 const MediaConstraintsInternal& aConstraints)
376 {
377 rv = AddStream(aMediaStream, aConstraints);
378 }
379
380 NS_IMETHODIMP AddStream(DOMMediaStream & aMediaStream,
381 const MediaConstraintsExternal& aConstraints);
382
383 NS_IMETHODIMP_TO_ERRORRESULT(RemoveStream, ErrorResult &rv,
384 DOMMediaStream& aMediaStream)
385 {
386 rv = RemoveStream(aMediaStream);
387 }
388
389 NS_IMETHODIMP GetFingerprint(char** fingerprint);
390 void GetFingerprint(nsAString& fingerprint)
391 {
392 char *tmp;
393 GetFingerprint(&tmp);
394 fingerprint.AssignASCII(tmp);
395 delete[] tmp;
396 }
397
398 NS_IMETHODIMP GetLocalDescription(char** aSDP);
399
400 void GetLocalDescription(nsAString& aSDP)
401 {
402 char *tmp;
403 GetLocalDescription(&tmp);
404 aSDP.AssignASCII(tmp);
405 delete tmp;
406 }
407
408 NS_IMETHODIMP GetRemoteDescription(char** aSDP);
409
410 void GetRemoteDescription(nsAString& aSDP)
411 {
412 char *tmp;
413 GetRemoteDescription(&tmp);
414 aSDP.AssignASCII(tmp);
415 delete tmp;
416 }
417
418 NS_IMETHODIMP ReadyState(mozilla::dom::PCImplReadyState* aState);
419
420 mozilla::dom::PCImplReadyState ReadyState()
421 {
422 mozilla::dom::PCImplReadyState state;
423 ReadyState(&state);
424 return state;
425 }
426
427 NS_IMETHODIMP SignalingState(mozilla::dom::PCImplSignalingState* aState);
428
429 mozilla::dom::PCImplSignalingState SignalingState()
430 {
431 mozilla::dom::PCImplSignalingState state;
432 SignalingState(&state);
433 return state;
434 }
435
436 NS_IMETHODIMP SipccState(mozilla::dom::PCImplSipccState* aState);
437
438 mozilla::dom::PCImplSipccState SipccState()
439 {
440 mozilla::dom::PCImplSipccState state;
441 SipccState(&state);
442 return state;
443 }
444
445 NS_IMETHODIMP IceConnectionState(
446 mozilla::dom::PCImplIceConnectionState* aState);
447
448 mozilla::dom::PCImplIceConnectionState IceConnectionState()
449 {
450 mozilla::dom::PCImplIceConnectionState state;
451 IceConnectionState(&state);
452 return state;
453 }
454
455 NS_IMETHODIMP IceGatheringState(
456 mozilla::dom::PCImplIceGatheringState* aState);
457
458 mozilla::dom::PCImplIceGatheringState IceGatheringState()
459 {
460 mozilla::dom::PCImplIceGatheringState state;
461 IceGatheringState(&state);
462 return state;
463 }
464
465 NS_IMETHODIMP Close();
466
467 void Close(ErrorResult &rv)
468 {
469 rv = Close();
470 }
471
472 nsresult InitializeDataChannel(int track_id, uint16_t aLocalport,
473 uint16_t aRemoteport, uint16_t aNumstreams);
474
475 NS_IMETHODIMP_TO_ERRORRESULT(ConnectDataConnection, ErrorResult &rv,
476 uint16_t aLocalport,
477 uint16_t aRemoteport,
478 uint16_t aNumstreams)
479 {
480 rv = ConnectDataConnection(aLocalport, aRemoteport, aNumstreams);
481 }
482
483 NS_IMETHODIMP_TO_ERRORRESULT_RETREF(nsDOMDataChannel,
484 CreateDataChannel, ErrorResult &rv,
485 const nsAString& aLabel,
486 const nsAString& aProtocol,
487 uint16_t aType,
488 bool outOfOrderAllowed,
489 uint16_t aMaxTime,
490 uint16_t aMaxNum,
491 bool aExternalNegotiated,
492 uint16_t aStream);
493
494 NS_IMETHODIMP_TO_ERRORRESULT(GetLocalStreams, ErrorResult &rv,
495 nsTArray<nsRefPtr<DOMMediaStream > >& result)
496 {
497 rv = GetLocalStreams(result);
498 }
499
500 NS_IMETHODIMP_TO_ERRORRESULT(GetRemoteStreams, ErrorResult &rv,
501 nsTArray<nsRefPtr<DOMMediaStream > >& result)
502 {
503 rv = GetRemoteStreams(result);
504 }
505
506 // Called whenever something is unrecognized by the parser
507 // May be called more than once and does not necessarily mean
508 // that parsing was stopped, only that something was unrecognized.
509 void OnSdpParseError(const char* errorMessage);
510
511 // Called when OnLocal/RemoteDescriptionSuccess/Error
512 // is called to start the list over.
513 void ClearSdpParseErrorMessages();
514
515 // Called to retreive the list of parsing errors.
516 const std::vector<std::string> &GetSdpParseErrors();
517
518 // Sets the RTC Signaling State
519 void SetSignalingState_m(mozilla::dom::PCImplSignalingState aSignalingState);
520
521 bool IsClosed() const;
522
523 bool HasMedia() const;
524
525 #ifdef MOZILLA_INTERNAL_API
526 // initialize telemetry for when calls start
527 void startCallTelem();
528
529 nsresult BuildStatsQuery_m(
530 mozilla::dom::MediaStreamTrack *aSelector,
531 RTCStatsQuery *query);
532
533 static nsresult ExecuteStatsQuery_s(RTCStatsQuery *query);
534 #endif
535
536 private:
537 PeerConnectionImpl(const PeerConnectionImpl&rhs);
538 PeerConnectionImpl& operator=(PeerConnectionImpl);
539 NS_IMETHODIMP Initialize(PeerConnectionObserver& aObserver,
540 nsGlobalWindow* aWindow,
541 const IceConfiguration* aConfiguration,
542 const RTCConfiguration* aRTCConfiguration,
543 nsISupports* aThread);
544
545 NS_IMETHODIMP EnsureDataConnection(uint16_t aNumstreams);
546
547 nsresult CloseInt();
548 void ChangeReadyState(mozilla::dom::PCImplReadyState aReadyState);
549 nsresult CheckApiState(bool assert_ice_ready) const;
550 void CheckThread() const {
551 NS_ABORT_IF_FALSE(CheckThreadInt(), "Wrong thread");
552 }
553 bool CheckThreadInt() const {
554 #ifdef MOZILLA_INTERNAL_API
555 // Thread assertions are disabled in the C++ unit tests because those
556 // make API calls off the main thread.
557 // TODO(ekr@rtfm.com): Fix the unit tests so they don't do that.
558 bool on;
559 NS_ENSURE_SUCCESS(mThread->IsOnCurrentThread(&on), false);
560 NS_ENSURE_TRUE(on, false);
561 #endif
562 return true;
563 }
564
565 #ifdef MOZILLA_INTERNAL_API
566 void virtualDestroyNSSReference() MOZ_FINAL;
567 void destructorSafeDestroyNSSReference();
568 nsresult GetTimeSinceEpoch(DOMHighResTimeStamp *result);
569 #endif
570
571 // Shut down media - called on main thread only
572 void ShutdownMedia();
573
574 NS_IMETHOD FingerprintSplitHelper(
575 std::string& fingerprint, size_t& spaceIdx) const;
576
577
578 #ifdef MOZILLA_INTERNAL_API
579 static void GetStatsForPCObserver_s(
580 const std::string& pcHandle,
581 nsAutoPtr<RTCStatsQuery> query);
582
583 // Sends an RTCStatsReport to JS. Must run on main thread.
584 static void DeliverStatsReportToPCObserver_m(
585 const std::string& pcHandle,
586 nsresult result,
587 nsAutoPtr<RTCStatsQuery> query);
588 #endif
589
590 // When ICE completes, we record a bunch of statistics that outlive the
591 // PeerConnection. This is just telemetry right now, but this can also
592 // include things like dumping the RLogRingbuffer somewhere, saving away
593 // an RTCStatsReport somewhere so it can be inspected after the call is over,
594 // or other things.
595 void RecordLongtermICEStatistics();
596
597 // Timecard used to measure processing time. This should be the first class
598 // attribute so that we accurately measure the time required to instantiate
599 // any other attributes of this class.
600 Timecard *mTimeCard;
601
602 // The call
603 mozilla::ScopedDeletePtr<Internal> mInternal;
604 mozilla::dom::PCImplReadyState mReadyState;
605 mozilla::dom::PCImplSignalingState mSignalingState;
606
607 // ICE State
608 mozilla::dom::PCImplIceConnectionState mIceConnectionState;
609 mozilla::dom::PCImplIceGatheringState mIceGatheringState;
610
611 nsCOMPtr<nsIThread> mThread;
612 // TODO: Remove if we ever properly wire PeerConnection for cycle-collection.
613 nsWeakPtr mPCObserver;
614
615 nsCOMPtr<nsPIDOMWindow> mWindow;
616
617 // The SDP sent in from JS - here for debugging.
618 std::string mLocalRequestedSDP;
619 std::string mRemoteRequestedSDP;
620 // The SDP we are using.
621 std::string mLocalSDP;
622 std::string mRemoteSDP;
623
624 // DTLS fingerprint
625 std::string mFingerprint;
626 std::string mRemoteFingerprint;
627
628 // The DTLS identity
629 mozilla::RefPtr<DtlsIdentity> mIdentity;
630
631 // A handle to refer to this PC with
632 std::string mHandle;
633
634 // A name for this PC that we are willing to expose to content.
635 std::string mName;
636
637 // The target to run stuff on
638 nsCOMPtr<nsIEventTarget> mSTSThread;
639
640 // CPU Load adaptation stuff
641 mozilla::LoadManager* mLoadManager;
642
643 #ifdef MOZILLA_INTERNAL_API
644 // DataConnection that's used to get all the DataChannels
645 nsRefPtr<mozilla::DataChannelConnection> mDataConnection;
646 #endif
647
648 nsRefPtr<PeerConnectionMedia> mMedia;
649
650 #ifdef MOZILLA_INTERNAL_API
651 // Start time of ICE, used for telemetry
652 mozilla::TimeStamp mIceStartTime;
653 // Start time of call used for Telemetry
654 mozilla::TimeStamp mStartTime;
655 #endif
656
657 // Temporary: used to prevent multiple audio streams or multiple video streams
658 // in a single PC. This is tied up in the IETF discussion around proper
659 // representation of multiple streams in SDP, and strongly related to
660 // Bug 840728.
661 int mNumAudioStreams;
662 int mNumVideoStreams;
663
664 bool mHaveDataStream;
665
666 // Holder for error messages from parsing SDP
667 std::vector<std::string> mSDPParseErrorMessages;
668
669 bool mTrickle;
670
671 public:
672 //these are temporary until the DataChannel Listen/Connect API is removed
673 unsigned short listenPort;
674 unsigned short connectPort;
675 char *connectStr; // XXX ownership/free
676 };
677
678 // This is what is returned when you acquire on a handle
679 class PeerConnectionWrapper
680 {
681 public:
682 PeerConnectionWrapper(const std::string& handle);
683
684 PeerConnectionImpl *impl() { return impl_; }
685
686 private:
687 nsRefPtr<PeerConnectionImpl> impl_;
688 };
689
690 } // end sipcc namespace
691
692 #undef NS_IMETHODIMP_TO_ERRORRESULT
693 #undef NS_IMETHODIMP_TO_ERRORRESULT_RETREF
694 #endif // _PEER_CONNECTION_IMPL_H_

mercurial