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

Side by Side Diff: content/renderer/media/peer_connection_handler_base.h

Issue 10383151: Refactor MediaStreamImpl and PeerConnection glue implementation after WebKit changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_BASE_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_BASE_H_
6 #define CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_BASE_H_ 6 #define CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_BASE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop_proxy.h" 12 #include "base/message_loop_proxy.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "third_party/libjingle/source/talk/app/webrtc/mediastream.h" 14 #include "third_party/libjingle/source/talk/app/webrtc/mediastream.h"
15 #include "third_party/libjingle/source/talk/app/webrtc/peerconnection.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" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amDescriptor.h"
17 17
18 class MediaStreamDependencyFactory; 18 class MediaStreamDependencyFactory;
19 class MediaStreamImpl; 19 class MediaStreamImpl;
20 20
21 // PeerConnectionHandlerBase is the base class of a delegate for the 21 // PeerConnectionHandlerBase is the base class of a delegate for the
22 // PeerConnection (JSEP or ROAP) API messages going between WebKit and native 22 // PeerConnection (JSEP or ROAP) API messages going between WebKit and native
23 // PeerConnection in libjingle. ROAP PeerConnection will be removed soon. 23 // PeerConnection in libjingle. ROAP PeerConnection will be removed soon.
24 class CONTENT_EXPORT PeerConnectionHandlerBase 24 class CONTENT_EXPORT PeerConnectionHandlerBase
25 : NON_EXPORTED_BASE(public webrtc::PeerConnectionObserver) { 25 : NON_EXPORTED_BASE(public webrtc::PeerConnectionObserver) {
26 public: 26 public:
27 PeerConnectionHandlerBase( 27 PeerConnectionHandlerBase(
28 MediaStreamImpl* msi,
29 MediaStreamDependencyFactory* dependency_factory); 28 MediaStreamDependencyFactory* dependency_factory);
30 29
31 webrtc::MediaStreamInterface* GetRemoteMediaStream(
32 const WebKit::WebMediaStreamDescriptor& stream);
33
34 void SetRemoteVideoRenderer(const std::string& source_id,
35 webrtc::VideoRendererWrapperInterface* renderer);
36
37 protected: 30 protected:
38 virtual ~PeerConnectionHandlerBase(); 31 virtual ~PeerConnectionHandlerBase();
39 32
40 void AddStream(const WebKit::WebMediaStreamDescriptor& stream); 33 void AddStream(const WebKit::WebMediaStreamDescriptor& stream);
41 void RemoveStream(const WebKit::WebMediaStreamDescriptor& stream); 34 void RemoveStream(const WebKit::WebMediaStreamDescriptor& stream);
42 WebKit::WebMediaStreamDescriptor CreateWebKitStreamDescriptor( 35 WebKit::WebMediaStreamDescriptor CreateWebKitStreamDescriptor(
43 webrtc::MediaStreamInterface* stream); 36 webrtc::MediaStreamInterface* stream);
44 // Returns a VideoTrack given the |source_id|
45 webrtc::VideoTrackInterface* FindRemoteVideoTrack(
46 const std::string& source_id);
47
48 // media_stream_impl_ is a raw pointer, and is valid for the lifetime of this
49 // class. Calls to it must be done on the render thread.
50 MediaStreamImpl* media_stream_impl_;
51 37
52 // dependency_factory_ is a raw pointer, and is valid for the lifetime of 38 // dependency_factory_ is a raw pointer, and is valid for the lifetime of
53 // MediaStreamImpl. 39 // MediaStreamImpl.
54 MediaStreamDependencyFactory* dependency_factory_; 40 MediaStreamDependencyFactory* dependency_factory_;
55 41
56 // native_peer_connection_ is the native PeerConnection object, 42 // native_peer_connection_ is the native PeerConnection object,
57 // it handles the ICE processing and media engine. 43 // it handles the ICE processing and media engine.
58 talk_base::scoped_refptr<webrtc::PeerConnectionInterface> 44 talk_base::scoped_refptr<webrtc::PeerConnectionInterface>
59 native_peer_connection_; 45 native_peer_connection_;
60 46
61 typedef std::map<webrtc::MediaStreamInterface*, 47 typedef std::map<webrtc::MediaStreamInterface*,
62 WebKit::WebMediaStreamDescriptor> RemoteStreamMap; 48 WebKit::WebMediaStreamDescriptor> RemoteStreamMap;
63 RemoteStreamMap remote_streams_; 49 RemoteStreamMap remote_streams_;
64 50
65 // Native PeerConnection only supports 1:1 mapping between MediaStream and
66 // video tag/renderer, so we restrict to this too. The key in
67 // VideoRendererMap is the track label.
68 typedef talk_base::scoped_refptr<webrtc::VideoRendererWrapperInterface>
69 VideoRendererPtr;
70
71 typedef std::map<std::string, VideoRendererPtr> VideoRendererMap;
72 VideoRendererMap video_renderers_;
73
74 // The message loop we are created on and on which to make calls to WebKit. 51 // The message loop we are created on and on which to make calls to WebKit.
75 // This should be the render thread message loop. 52 // This should be the render thread message loop.
76 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 53 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
77 54
78 DISALLOW_COPY_AND_ASSIGN(PeerConnectionHandlerBase); 55 DISALLOW_COPY_AND_ASSIGN(PeerConnectionHandlerBase);
79 }; 56 };
80 57
81 #endif // CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_BASE_H_ 58 #endif // CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698