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 class CONTENT_EXPORT RTCPeerConnectionHandler |
| 19 : public PeerConnectionHandlerBase, |
| 20 NON_EXPORTED_BASE(public WebKit::WebRTCPeerConnectionHandler) { |
| 21 public: |
| 22 RTCPeerConnectionHandler( |
| 23 WebKit::WebRTCPeerConnectionHandlerClient* client, |
| 24 MediaStreamDependencyFactory* dependency_factory); |
| 25 virtual ~RTCPeerConnectionHandler(); |
| 26 |
| 27 // WebKit::WebRTCPeerConnectionHandler implementation |
| 28 virtual bool initialize( |
| 29 const WebKit::WebRTCConfiguration& server_configuration, |
| 30 const WebKit::WebMediaConstraints& options) OVERRIDE; |
| 31 |
| 32 virtual void createOffer( |
| 33 const WebKit::WebRTCSessionDescriptionRequest& request, |
| 34 const WebKit::WebMediaConstraints& options) OVERRIDE; |
| 35 virtual void createAnswer( |
| 36 const WebKit::WebRTCSessionDescriptionRequest& request, |
| 37 const WebKit::WebMediaConstraints& options) OVERRIDE; |
| 38 |
| 39 virtual void setLocalDescription( |
| 40 const WebKit::WebRTCVoidRequest& request, |
| 41 const WebKit::WebRTCSessionDescriptionDescriptor& description) OVERRIDE; |
| 42 virtual void setRemoteDescription( |
| 43 const WebKit::WebRTCVoidRequest& request, |
| 44 const WebKit::WebRTCSessionDescriptionDescriptor& description) OVERRIDE; |
| 45 |
| 46 virtual WebKit::WebRTCSessionDescriptionDescriptor localDescription() |
| 47 OVERRIDE; |
| 48 virtual WebKit::WebRTCSessionDescriptionDescriptor remoteDescription() |
| 49 OVERRIDE; |
| 50 virtual bool updateICE( |
| 51 const WebKit::WebRTCConfiguration& server_configuration, |
| 52 const WebKit::WebMediaConstraints& options) OVERRIDE; |
| 53 virtual bool addICECandidate( |
| 54 const WebKit::WebRTCICECandidateDescriptor& candidate) OVERRIDE; |
| 55 |
| 56 virtual bool addStream( |
| 57 const WebKit::WebMediaStreamDescriptor& stream, |
| 58 const WebKit::WebMediaConstraints& options) OVERRIDE; |
| 59 virtual void removeStream( |
| 60 const WebKit::WebMediaStreamDescriptor& stream) OVERRIDE; |
| 61 // We will be deleted by WebKit after stop has been returned. |
| 62 virtual void stop() OVERRIDE; |
| 63 |
| 64 // webrtc::PeerConnectionObserver implementation |
| 65 virtual void OnError() OVERRIDE; |
| 66 virtual void OnStateChange(StateType state_changed) OVERRIDE; |
| 67 virtual void OnAddStream(webrtc::MediaStreamInterface* stream) OVERRIDE; |
| 68 virtual void OnRemoveStream(webrtc::MediaStreamInterface* stream) OVERRIDE; |
| 69 virtual void OnIceCandidate( |
| 70 const webrtc::IceCandidateInterface* candidate) OVERRIDE; |
| 71 virtual void OnIceComplete() OVERRIDE; |
| 72 virtual void OnRenegotiationNeeded() OVERRIDE; |
| 73 |
| 74 private: |
| 75 webrtc::SessionDescriptionInterface* CreateNativeSessionDescription( |
| 76 const WebKit::WebRTCSessionDescriptionDescriptor& description); |
| 77 |
| 78 // |client_| is a weak pointer, and is valid until stop() has returned. |
| 79 WebKit::WebRTCPeerConnectionHandlerClient* client_; |
| 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(RTCPeerConnectionHandler); |
| 82 }; |
| 83 |
| 84 #endif // CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ |
OLD | NEW |