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

Unified Diff: content/renderer/media/media_stream_impl.h

Issue 9543001: Support for multiple PeerConnections (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/media_stream_impl.h
diff --git a/content/renderer/media/media_stream_impl.h b/content/renderer/media/media_stream_impl.h
index 503c510b12659c43c84580402d10476ea3f617fb..717894109038e2b0f614a6375f3ed002ed777bdb 100644
--- a/content/renderer/media/media_stream_impl.h
+++ b/content/renderer/media/media_stream_impl.h
@@ -8,6 +8,7 @@
#include <list>
#include <map>
#include <string>
+#include <utility>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
@@ -72,7 +73,7 @@ class CONTENT_EXPORT MediaStreamImpl
virtual WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler(
WebKit::WebPeerConnectionHandlerClient* client);
- virtual void ClosePeerConnection();
+ virtual void ClosePeerConnection(PeerConnectionHandler* pc_handler);
virtual webrtc::MediaStreamTrackInterface* GetLocalMediaStreamTrack(
const std::string& label);
@@ -114,6 +115,7 @@ class CONTENT_EXPORT MediaStreamImpl
private:
FRIEND_TEST_ALL_PREFIXES(MediaStreamImplTest, Basic);
+ FRIEND_TEST_ALL_PREFIXES(MediaStreamImplTest, MultiplePeerConnections);
class VideoRendererWrapper : public webrtc::VideoRendererWrapperInterface {
public:
@@ -153,10 +155,10 @@ class CONTENT_EXPORT MediaStreamImpl
scoped_refptr<VideoCaptureImplManager> vc_manager_;
- // peer_connection_handler_ is a weak reference, owned by WebKit. It's valid
- // until stop is called on it (which will call ClosePeerConnection on us).
- // TODO(grunell): Support several PeerConnectionsHandlers.
- PeerConnectionHandler* peer_connection_handler_;
+ // peer_connection_handlers_ contains raw references, owned by WebKit. A
+ // pointer is valid until stop is called on the object (which will call
+ // ClosePeerConnection on us and we remove the pointer).
+ std::list<PeerConnectionHandler*> peer_connection_handlers_;
// We keep a list of the generated local tracks, so that we can add capture
// devices when generated and also use them for recording.
@@ -165,8 +167,12 @@ class CONTENT_EXPORT MediaStreamImpl
typedef std::map<std::string, MediaStreamTrackPtr> MediaStreamTrackPtrMap;
MediaStreamTrackPtrMap local_tracks_;
- talk_base::scoped_refptr<VideoRendererWrapper> video_renderer_;
- scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
+ // Native PeerConnection only supports 1:1 mapping between MediaStream and
+ // video tag/renderer, so we restrict to this too.
+ typedef talk_base::scoped_refptr<VideoRendererWrapper> VideoRendererPtr;
+ typedef std::pair<VideoRendererPtr, PeerConnectionHandler*> VideoRendererPair;
+ typedef std::map<std::string, VideoRendererPair> VideoRendererMap;
tommi (sloooow) - chröme 2012/02/29 13:37:00 maybe a comment that documents what the key is?
Henrik Grunell 2012/03/23 12:51:56 Done.
+ VideoRendererMap video_renderers_;
// PeerConnection threads. signaling_thread_ is created from the
// "current" chrome thread.
« no previous file with comments | « no previous file | content/renderer/media/media_stream_impl.cc » ('j') | content/renderer/media/media_stream_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698