1 // Copyright 2013 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_MEDIA_STREAM_VIDEO_TRACK_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_ 7 8 #include "base/compiler_specific.h" 9 #include "base/memory/scoped_vector.h" 10 #include "base/threading/thread_checker.h" 11 #include "content/common/content_export.h" 12 #include "content/public/renderer/media_stream_video_sink.h" 13 #include "content/renderer/media/media_stream_track_extra_data.h" 14 15 namespace webrtc { 16 class VideoTrackInterface; 17 } 18 19 namespace content { 20 21 class WebRtcVideoSinkAdapter; 22 23 // MediaStreamVideoTrack is a video specific representation of a 24 // blink::WebMediaStreamTrack in content. It is owned by the blink object 25 // and can be retrieved from a blink object using 26 // WebMediaStreamTrack::extraData() 27 class CONTENT_EXPORT MediaStreamVideoTrack : public MediaStreamTrackExtraData { 28 public: 29 MediaStreamVideoTrack(webrtc::VideoTrackInterface* track, 30 bool is_local_track); 31 virtual ~MediaStreamVideoTrack(); 32 void AddSink(MediaStreamVideoSink* sink); 33 void RemoveSink(MediaStreamVideoSink* sink); 34 35 private: 36 // Used to DCHECK that we are called on the correct thread. 37 base::ThreadChecker thread_checker_; 38 // The webrtc video track. 39 // TODO(perkj): Make this class independent of webrtc as part of project 40 // Piranha Plant. 41 webrtc::VideoTrackInterface* video_track_; 42 ScopedVector<WebRtcVideoSinkAdapter> sinks_; 43 44 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoTrack); 45 }; 46 47 } // namespace content 48 49 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_ 50