OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_BASE_H_ | |
6 #define CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_BASE_H_ | |
7 | |
8 #include <map> | |
9 #include <string> | |
10 | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/message_loop_proxy.h" | |
13 #include "content/common/content_export.h" | |
14 #include "third_party/libjingle/source/talk/app/webrtc/mediastream.h" | |
15 #include "third_party/libjingle/source/talk/app/webrtc/peerconnection.h" | |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre
amDescriptor.h" | |
17 | |
18 class MediaStreamDependencyFactory; | |
19 class MediaStreamImpl; | |
20 | |
21 // PeerConnectionHandlerBase is the base class of a delegate for the | |
22 // PeerConnection (JSEP or ROAP) API messages going between WebKit and native | |
23 // PeerConnection in libjingle. ROAP PeerConnection will be removed soon. | |
24 class CONTENT_EXPORT PeerConnectionHandlerBase | |
25 : NON_EXPORTED_BASE(public webrtc::PeerConnectionObserver) { | |
26 public: | |
27 PeerConnectionHandlerBase( | |
28 MediaStreamImpl* msi, | |
29 MediaStreamDependencyFactory* dependency_factory); | |
30 | |
31 // Checks if a remote stream belongs to this PeerConnection. | |
32 virtual bool HasStream(const std::string& stream_label); | |
33 | |
34 // Set the video renderer for the specified stream. | |
35 virtual void SetVideoRenderer( | |
36 const std::string& stream_label, | |
37 webrtc::VideoRendererWrapperInterface* renderer); | |
38 | |
39 protected: | |
40 virtual ~PeerConnectionHandlerBase(); | |
41 | |
42 void AddStream(const WebKit::WebMediaStreamDescriptor& stream); | |
43 void RemoveStream(const WebKit::WebMediaStreamDescriptor& stream); | |
44 WebKit::WebMediaStreamDescriptor CreateWebKitStreamDescriptor( | |
45 webrtc::MediaStreamInterface* stream); | |
46 | |
47 // media_stream_impl_ is a raw pointer, and is valid for the lifetime of this | |
48 // class. Calls to it must be done on the render thread. | |
49 MediaStreamImpl* media_stream_impl_; | |
50 | |
51 // dependency_factory_ is a raw pointer, and is valid for the lifetime of | |
52 // MediaStreamImpl. | |
53 MediaStreamDependencyFactory* dependency_factory_; | |
54 | |
55 // native_peer_connection_ is the native PeerConnection object, | |
56 // it handles the ICE processing and media engine. | |
57 talk_base::scoped_refptr<webrtc::PeerConnectionInterface> | |
58 native_peer_connection_; | |
59 | |
60 typedef std::map<webrtc::MediaStreamInterface*, | |
61 WebKit::WebMediaStreamDescriptor> RemoteStreamMap; | |
62 RemoteStreamMap remote_streams_; | |
63 | |
64 // The message loop we are created on and on which to make calls to WebKit. | |
65 // This should be the render thread message loop. | |
66 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(PeerConnectionHandlerBase); | |
69 }; | |
70 | |
71 #endif // CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_BASE_H_ | |
OLD | NEW |