#ifndef CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_
#define CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_
+#include <map>
+#include <string>
+
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
-#include "content/renderer/media/peer_connection_handler_base.h"
#include "content/renderer/media/webrtc/media_stream_track_metrics.h"
#include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h"
#include "third_party/WebKit/public/platform/WebRTCStatsRequest.h"
namespace blink {
class WebFrame;
class WebRTCDataChannelHandler;
+class WebRTCOfferOptions;
}
namespace content {
+class PeerConnectionDependencyFactory;
class PeerConnectionTracker;
+class RemoteMediaStreamImpl;
+class RTCMediaConstraints;
+class WebRtcMediaStreamAdapter;
// Mockable wrapper for blink::WebRTCStatsResponse
class CONTENT_EXPORT LocalRTCStatsResponse
- : public NON_EXPORTED_BASE(talk_base::RefCountInterface) {
+ : public NON_EXPORTED_BASE(rtc::RefCountInterface) {
public:
explicit LocalRTCStatsResponse(const blink::WebRTCStatsResponse& impl)
: impl_(impl) {
// Mockable wrapper for blink::WebRTCStatsRequest
class CONTENT_EXPORT LocalRTCStatsRequest
- : public NON_EXPORTED_BASE(talk_base::RefCountInterface) {
+ : public NON_EXPORTED_BASE(rtc::RefCountInterface) {
public:
explicit LocalRTCStatsRequest(blink::WebRTCStatsRequest impl);
// Constructor for testing.
private:
blink::WebRTCStatsRequest impl_;
- talk_base::scoped_refptr<LocalRTCStatsResponse> response_;
+ rtc::scoped_refptr<LocalRTCStatsResponse> response_;
};
// RTCPeerConnectionHandler is a delegate for the RTC PeerConnection API
// Callbacks to the webrtc::PeerConnectionObserver implementation also occur on
// the main render thread.
class CONTENT_EXPORT RTCPeerConnectionHandler
- : public PeerConnectionHandlerBase,
- NON_EXPORTED_BASE(public blink::WebRTCPeerConnectionHandler) {
+ : NON_EXPORTED_BASE(public blink::WebRTCPeerConnectionHandler),
+ NON_EXPORTED_BASE(public webrtc::PeerConnectionObserver) {
public:
RTCPeerConnectionHandler(
blink::WebRTCPeerConnectionHandlerClient* client,
- MediaStreamDependencyFactory* dependency_factory);
+ PeerConnectionDependencyFactory* dependency_factory);
virtual ~RTCPeerConnectionHandler();
+ // Destroy all existing RTCPeerConnectionHandler objects.
+ static void DestructAllHandlers();
+
+ static void ConvertOfferOptionsToConstraints(
+ const blink::WebRTCOfferOptions& options,
+ RTCMediaConstraints* output);
+
void associateWithFrame(blink::WebFrame* frame);
// Initialize method only used for unit test.
virtual void createOffer(
const blink::WebRTCSessionDescriptionRequest& request,
const blink::WebMediaConstraints& options) OVERRIDE;
+ virtual void createOffer(
+ const blink::WebRTCSessionDescriptionRequest& request,
+ const blink::WebRTCOfferOptions& options) OVERRIDE;
+
virtual void createAnswer(
const blink::WebRTCSessionDescriptionRequest& request,
const blink::WebMediaConstraints& options) OVERRIDE;
PeerConnectionTracker* peer_connection_tracker();
+ protected:
+ webrtc::PeerConnectionInterface* native_peer_connection() {
+ return native_peer_connection_.get();
+ }
+
private:
webrtc::SessionDescriptionInterface* CreateNativeSessionDescription(
const blink::WebRTCSessionDescription& description,
// |client_| is a weak pointer, and is valid until stop() has returned.
blink::WebRTCPeerConnectionHandlerClient* client_;
+ // |dependency_factory_| is a raw pointer, and is valid for the lifetime of
+ // RenderThreadImpl.
+ PeerConnectionDependencyFactory* dependency_factory_;
+
blink::WebFrame* frame_;
+ ScopedVector<WebRtcMediaStreamAdapter> local_streams_;
+
PeerConnectionTracker* peer_connection_tracker_;
MediaStreamTrackMetrics track_metrics_;
// Counter for a UMA stat reported at destruction time.
int num_data_channels_created_;
+ // |native_peer_connection_| is the libjingle native PeerConnection object.
+ scoped_refptr<webrtc::PeerConnectionInterface> native_peer_connection_;
+
+ typedef std::map<webrtc::MediaStreamInterface*,
+ content::RemoteMediaStreamImpl*> RemoteStreamMap;
+ RemoteStreamMap remote_streams_;
+ scoped_refptr<webrtc::UMAObserver> uma_observer_;
+ base::TimeTicks ice_connection_checking_start_;
+
DISALLOW_COPY_AND_ASSIGN(RTCPeerConnectionHandler);
};