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

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

Issue 10038009: Revert 131949 (multiple memory leaks) - Adding JSEP PeerConnection glue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_H_
6 #define CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_H_ 6 #define CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_H_
7 7
8 #include <map>
8 #include <string> 9 #include <string>
9 10
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop_proxy.h"
13 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
14 #include "content/renderer/media/peer_connection_handler_base.h" 17 #include "third_party/libjingle/source/talk/app/webrtc/mediastream.h"
18 #include "third_party/libjingle/source/talk/app/webrtc/peerconnection.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ctionHandler.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ctionHandler.h"
16 20
17 // PeerConnectionHandler is a delegate for the ROAP PeerConnection API messages 21 class MediaStreamDependencyFactory;
18 // going between WebKit and native PeerConnection in libjingle. It's owned by 22 class MediaStreamImpl;
19 // WebKit. ROAP PeerConnection will be removed soon. 23
24 // PeerConnectionHandler is a delegate for the PeerConnection API messages going
25 // between WebKit and native PeerConnection in libjingle. It's owned by
26 // WebKit.
20 class CONTENT_EXPORT PeerConnectionHandler 27 class CONTENT_EXPORT PeerConnectionHandler
21 : public PeerConnectionHandlerBase, 28 : NON_EXPORTED_BASE(public WebKit::WebPeerConnectionHandler),
22 NON_EXPORTED_BASE(public WebKit::WebPeerConnectionHandler) { 29 NON_EXPORTED_BASE(public webrtc::PeerConnectionObserver) {
23 public: 30 public:
24 PeerConnectionHandler( 31 PeerConnectionHandler(
25 WebKit::WebPeerConnectionHandlerClient* client, 32 WebKit::WebPeerConnectionHandlerClient* client,
26 MediaStreamImpl* msi, 33 MediaStreamImpl* msi,
27 MediaStreamDependencyFactory* dependency_factory); 34 MediaStreamDependencyFactory* dependency_factory);
28 virtual ~PeerConnectionHandler(); 35 virtual ~PeerConnectionHandler();
29 36
37 // Set the video renderer for the specified stream.
38 virtual void SetVideoRenderer(
39 const std::string& stream_label,
40 webrtc::VideoRendererWrapperInterface* renderer);
41
30 // WebKit::WebPeerConnectionHandler implementation 42 // WebKit::WebPeerConnectionHandler implementation
31 virtual void initialize( 43 virtual void initialize(
32 const WebKit::WebString& server_configuration, 44 const WebKit::WebString& server_configuration,
33 const WebKit::WebString& username) OVERRIDE; 45 const WebKit::WebString& username) OVERRIDE;
34 virtual void produceInitialOffer( 46 virtual void produceInitialOffer(
35 const WebKit::WebVector<WebKit::WebMediaStreamDescriptor>& 47 const WebKit::WebVector<WebKit::WebMediaStreamDescriptor>&
36 pending_add_streams) OVERRIDE; 48 pending_add_streams) OVERRIDE;
37 virtual void handleInitialOffer(const WebKit::WebString& sdp) OVERRIDE; 49 virtual void handleInitialOffer(const WebKit::WebString& sdp) OVERRIDE;
38 virtual void processSDP(const WebKit::WebString& sdp) OVERRIDE; 50 virtual void processSDP(const WebKit::WebString& sdp) OVERRIDE;
39 virtual void processPendingStreams( 51 virtual void processPendingStreams(
(...skipping 12 matching lines...) Expand all
52 virtual void OnStateChange(StateType state_changed) OVERRIDE; 64 virtual void OnStateChange(StateType state_changed) OVERRIDE;
53 virtual void OnAddStream(webrtc::MediaStreamInterface* stream) OVERRIDE; 65 virtual void OnAddStream(webrtc::MediaStreamInterface* stream) OVERRIDE;
54 virtual void OnRemoveStream(webrtc::MediaStreamInterface* stream) OVERRIDE; 66 virtual void OnRemoveStream(webrtc::MediaStreamInterface* stream) OVERRIDE;
55 virtual void OnIceCandidate( 67 virtual void OnIceCandidate(
56 const webrtc::IceCandidateInterface* candidate) OVERRIDE; 68 const webrtc::IceCandidateInterface* candidate) OVERRIDE;
57 virtual void OnIceComplete() OVERRIDE; 69 virtual void OnIceComplete() OVERRIDE;
58 70
59 private: 71 private:
60 FRIEND_TEST_ALL_PREFIXES(PeerConnectionHandlerTest, Basic); 72 FRIEND_TEST_ALL_PREFIXES(PeerConnectionHandlerTest, Basic);
61 73
74 void AddStreams(
75 const WebKit::WebVector<WebKit::WebMediaStreamDescriptor>& streams);
76 void RemoveStreams(
77 const WebKit::WebVector<WebKit::WebMediaStreamDescriptor>& streams);
62 void OnAddStreamCallback(webrtc::MediaStreamInterface* stream); 78 void OnAddStreamCallback(webrtc::MediaStreamInterface* stream);
63 void OnRemoveStreamCallback(webrtc::MediaStreamInterface* stream); 79 void OnRemoveStreamCallback(webrtc::MediaStreamInterface* stream);
80 WebKit::WebMediaStreamDescriptor CreateWebKitStreamDescriptor(
81 webrtc::MediaStreamInterface* stream);
64 82
65 // client_ is a weak pointer, and is valid until stop() has returned. 83 // client_ is a weak pointer, and is valid until stop() has returned.
66 WebKit::WebPeerConnectionHandlerClient* client_; 84 WebKit::WebPeerConnectionHandlerClient* client_;
67 85
86 // media_stream_impl_ is a weak pointer, and is valid for the lifetime of this
87 // class. Calls to it must be done on the render thread.
88 MediaStreamImpl* media_stream_impl_;
89
90 // dependency_factory_ is a weak pointer, and is valid for the lifetime of
91 // MediaStreamImpl.
92 MediaStreamDependencyFactory* dependency_factory_;
93
94 // native_peer_connection_ is the native PeerConnection object,
95 // it handles the ICE processing and media engine.
96 talk_base::scoped_refptr<webrtc::PeerConnectionInterface>
97 native_peer_connection_;
98
99 typedef std::map<webrtc::MediaStreamInterface*,
100 WebKit::WebMediaStreamDescriptor> RemoteStreamMap;
101 RemoteStreamMap remote_streams_;
102
103 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
104
68 DISALLOW_COPY_AND_ASSIGN(PeerConnectionHandler); 105 DISALLOW_COPY_AND_ASSIGN(PeerConnectionHandler);
69 }; 106 };
70 107
71 #endif // CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_H_ 108 #endif // CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698