summaryrefslogtreecommitdiffstats
path: root/chromium/content/renderer/media/media_stream_video_track.h
blob: 410a8f9a40b8c4cbbb0857e0c1976560b580e0fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_
#define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_

#include "base/compiler_specific.h"
#include "base/memory/scoped_vector.h"
#include "base/threading/thread_checker.h"
#include "content/common/content_export.h"
#include "content/public/renderer/media_stream_video_sink.h"
#include "content/renderer/media/media_stream_track_extra_data.h"

namespace webrtc {
class VideoTrackInterface;
}

namespace content {

class WebRtcVideoSinkAdapter;

// MediaStreamVideoTrack is a video specific representation of a
// blink::WebMediaStreamTrack in content. It is owned by the blink object
// and can be retrieved from a blink object using
// WebMediaStreamTrack::extraData()
class CONTENT_EXPORT MediaStreamVideoTrack : public MediaStreamTrackExtraData {
 public:
  MediaStreamVideoTrack(webrtc::VideoTrackInterface* track,
                        bool is_local_track);
  virtual ~MediaStreamVideoTrack();
  void AddSink(MediaStreamVideoSink* sink);
  void RemoveSink(MediaStreamVideoSink* sink);

 private:
  // Used to DCHECK that we are called on the correct thread.
  base::ThreadChecker thread_checker_;
  // The webrtc video track.
  // TODO(perkj): Make this class independent of webrtc as part of project
  // Piranha Plant.
  webrtc::VideoTrackInterface* video_track_;
  ScopedVector<WebRtcVideoSinkAdapter> sinks_;

  DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoTrack);
};

}  // namespace content

#endif  // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_TRACK_H_