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.
5 #ifndef CONTENT_RENDERER_MEDIA_REMOTE_MEDIA_STREAM_IMPL_H_
6 #define CONTENT_RENDERER_MEDIA_REMOTE_MEDIA_STREAM_IMPL_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_vector.h"
12 #include "base/threading/non_thread_safe.h"
13 #include "content/common/content_export.h"
14 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
15 #include "third_party/WebKit/public/platform/WebMediaStream.h"
16 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
17 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
21 class RemoteMediaStreamTrackAdapter
;
23 // RemoteMediaStreamImpl serves as a container and glue between remote webrtc
24 // MediaStreams and WebKit MediaStreams. For each remote MediaStream received
25 // on a PeerConnection a RemoteMediaStreamImpl instance is created and
26 // owned by RtcPeerConnection.
27 class CONTENT_EXPORT RemoteMediaStreamImpl
28 : NON_EXPORTED_BASE(public webrtc::ObserverInterface
),
29 NON_EXPORTED_BASE(public base::NonThreadSafe
) {
31 explicit RemoteMediaStreamImpl(
32 webrtc::MediaStreamInterface
* webrtc_stream
);
33 virtual ~RemoteMediaStreamImpl();
35 const blink::WebMediaStream
& webkit_stream() { return webkit_stream_
; }
38 // webrtc::ObserverInterface implementation.
39 virtual void OnChanged() OVERRIDE
;
41 scoped_refptr
<webrtc::MediaStreamInterface
> webrtc_stream_
;
42 ScopedVector
<RemoteMediaStreamTrackAdapter
> video_track_observers_
;
43 ScopedVector
<RemoteMediaStreamTrackAdapter
> audio_track_observers_
;
44 blink::WebMediaStream webkit_stream_
;
46 DISALLOW_COPY_AND_ASSIGN(RemoteMediaStreamImpl
);
49 } // namespace content
51 #endif // CONTENT_RENDERER_MEDIA_REMOTE_MEDIA_STREAM_IMPL_H_