cc: Make picture pile base thread safe.
[chromium-blink-merge.git] / content / renderer / media / media_stream_track.h
blob1a87a81d759fe3ee61f6f16782ecf31264eb9311
1 // Copyright 2014 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_MEDIA_STREAM_TRACK_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_TRACK_H_
8 #include "base/callback.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/threading/thread_checker.h"
12 #include "content/common/content_export.h"
13 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
15 namespace webrtc {
16 class AudioTrackInterface;
17 class MediaStreamTrackInterface;
18 } // namespace webrtc
20 namespace content {
22 // MediaStreamTrack is a Chrome representation of blink::WebMediaStreamTrack.
23 // It is owned by blink::WebMediaStreamTrack as
24 // blink::WebMediaStreamTrack::ExtraData.
25 class CONTENT_EXPORT MediaStreamTrack
26 : NON_EXPORTED_BASE(public blink::WebMediaStreamTrack::ExtraData) {
27 public:
28 MediaStreamTrack(
29 const scoped_refptr<webrtc::MediaStreamTrackInterface>& track,
30 bool is_local_track);
31 virtual ~MediaStreamTrack();
33 static MediaStreamTrack* GetTrack(
34 const blink::WebMediaStreamTrack& track);
36 // If a subclass overrides this method it has to call the base class.
37 virtual void SetEnabled(bool enabled);
39 // TODO(xians): Make this pure virtual when Stop[Track] has been
40 // implemented for remote audio tracks.
41 virtual void Stop();
43 virtual webrtc::AudioTrackInterface* GetAudioAdapter();
45 bool is_local_track () const { return is_local_track_; }
47 protected:
48 scoped_refptr<webrtc::MediaStreamTrackInterface> track_;
50 private:
51 const bool is_local_track_;
53 base::ThreadChecker thread_checker_;
55 DISALLOW_COPY_AND_ASSIGN(MediaStreamTrack);
58 } // namespace content
60 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_TRACK_H_