1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_BASE_H_
6 #define CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_BASE_H_
11 #include "base/memory/ref_counted.h"
12 #include "base/message_loop/message_loop_proxy.h"
13 #include "content/common/content_export.h"
14 #include "third_party/WebKit/public/platform/WebMediaStream.h"
15 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
16 #include "third_party/libjingle/source/talk/app/webrtc/mediastream.h"
17 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h"
20 class MediaStreamDependencyFactory
;
21 class RemoteMediaStreamImpl
;
23 // PeerConnectionHandlerBase is the base class of a delegate for the
24 // PeerConnection API messages going between WebKit and native
25 // PeerConnection in libjingle.
26 class CONTENT_EXPORT PeerConnectionHandlerBase
27 : NON_EXPORTED_BASE(public webrtc::PeerConnectionObserver
) {
29 PeerConnectionHandlerBase(
30 MediaStreamDependencyFactory
* dependency_factory
);
33 virtual ~PeerConnectionHandlerBase();
35 void AddStream(const blink::WebMediaStream
& stream
);
36 bool AddStream(const blink::WebMediaStream
& stream
,
37 const webrtc::MediaConstraintsInterface
* constraints
);
38 void RemoveStream(const blink::WebMediaStream
& stream
);
40 // dependency_factory_ is a raw pointer, and is valid for the lifetime of
42 MediaStreamDependencyFactory
* dependency_factory_
;
44 // native_peer_connection_ is the native PeerConnection object,
45 // it handles the ICE processing and media engine.
46 scoped_refptr
<webrtc::PeerConnectionInterface
> native_peer_connection_
;
48 typedef std::map
<webrtc::MediaStreamInterface
*,
49 content::RemoteMediaStreamImpl
*> RemoteStreamMap
;
50 RemoteStreamMap remote_streams_
;
52 // The message loop we are created on and on which to make calls to WebKit.
53 // This should be the render thread message loop.
54 scoped_refptr
<base::MessageLoopProxy
> message_loop_proxy_
;
56 DISALLOW_COPY_AND_ASSIGN(PeerConnectionHandlerBase
);
59 } // namespace content
61 #endif // CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_BASE_H_