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_RTC_PEER_CONNECTION_HANDLER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "content/common/content_export.h" |
| 11 #include "content/renderer/media/peer_connection_handler_base.h" |
| 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCPeerConnectio
nHandler.h" |
| 13 |
| 14 // RTCPeerConnectionHandler is a delegate for the RTC PeerConnection API |
| 15 // messages going between WebKit and native PeerConnection in libjingle. It's |
| 16 // owned by WebKit. |
| 17 // WebKit call all of these methods on the main render thread. |
| 18 // Callbacks to the webrtc::PeerConnectionObserver implementation also occur on |
| 19 // the main render thread. |
| 20 class CONTENT_EXPORT RTCPeerConnectionHandler |
| 21 : public PeerConnectionHandlerBase, |
| 22 NON_EXPORTED_BASE(public WebKit::WebRTCPeerConnectionHandler) { |
| 23 public: |
| 24 RTCPeerConnectionHandler( |
| 25 WebKit::WebRTCPeerConnectionHandlerClient* client, |
| 26 MediaStreamDependencyFactory* dependency_factory); |
| 27 virtual ~RTCPeerConnectionHandler(); |
| 28 |
| 29 // WebKit::WebRTCPeerConnectionHandler implementation |
| 30 virtual bool initialize( |
| 31 const WebKit::WebRTCConfiguration& server_configuration, |
| 32 const WebKit::WebMediaConstraints& options) OVERRIDE; |
| 33 |
| 34 virtual void createOffer( |
| 35 const WebKit::WebRTCSessionDescriptionRequest& request, |
| 36 const WebKit::WebMediaConstraints& options) OVERRIDE; |
| 37 virtual void createAnswer( |
| 38 const WebKit::WebRTCSessionDescriptionRequest& request, |
| 39 const WebKit::WebMediaConstraints& options) OVERRIDE; |
| 40 |
| 41 virtual void setLocalDescription( |
| 42 const WebKit::WebRTCVoidRequest& request, |
| 43 const WebKit::WebRTCSessionDescription& description) OVERRIDE; |
| 44 virtual void setRemoteDescription( |
| 45 const WebKit::WebRTCVoidRequest& request, |
| 46 const WebKit::WebRTCSessionDescription& description) OVERRIDE; |
| 47 |
| 48 virtual WebKit::WebRTCSessionDescription localDescription() |
| 49 OVERRIDE; |
| 50 virtual WebKit::WebRTCSessionDescription remoteDescription() |
| 51 OVERRIDE; |
| 52 virtual bool updateICE( |
| 53 const WebKit::WebRTCConfiguration& server_configuration, |
| 54 const WebKit::WebMediaConstraints& options) OVERRIDE; |
| 55 virtual bool addICECandidate( |
| 56 const WebKit::WebRTCICECandidate& candidate) OVERRIDE; |
| 57 |
| 58 virtual bool addStream( |
| 59 const WebKit::WebMediaStreamDescriptor& stream, |
| 60 const WebKit::WebMediaConstraints& options) OVERRIDE; |
| 61 virtual void removeStream( |
| 62 const WebKit::WebMediaStreamDescriptor& stream) OVERRIDE; |
| 63 // We will be deleted by WebKit after stop has been returned. |
| 64 virtual void stop() OVERRIDE; |
| 65 |
| 66 // webrtc::PeerConnectionObserver implementation |
| 67 virtual void OnError() OVERRIDE; |
| 68 virtual void OnStateChange(StateType state_changed) OVERRIDE; |
| 69 virtual void OnAddStream(webrtc::MediaStreamInterface* stream) OVERRIDE; |
| 70 virtual void OnRemoveStream(webrtc::MediaStreamInterface* stream) OVERRIDE; |
| 71 virtual void OnIceCandidate( |
| 72 const webrtc::IceCandidateInterface* candidate) OVERRIDE; |
| 73 virtual void OnIceComplete() OVERRIDE; |
| 74 virtual void OnRenegotiationNeeded() OVERRIDE; |
| 75 |
| 76 private: |
| 77 webrtc::SessionDescriptionInterface* CreateNativeSessionDescription( |
| 78 const WebKit::WebRTCSessionDescription& description); |
| 79 |
| 80 // |client_| is a weak pointer, and is valid until stop() has returned. |
| 81 WebKit::WebRTCPeerConnectionHandlerClient* client_; |
| 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(RTCPeerConnectionHandler); |
| 84 }; |
| 85 |
| 86 #endif // CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ |
OLD | NEW |