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