Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / renderer / media / media_stream_track.h
bloba941b59b62e4bfe67304686133bdefb8c4239993
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_EXTRA_DATA_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_TRACK_EXTRA_DATA_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(webrtc::MediaStreamTrackInterface* track,
29 bool is_local_track);
30 virtual ~MediaStreamTrack();
32 static MediaStreamTrack* GetTrack(
33 const blink::WebMediaStreamTrack& track);
35 // If a subclass overrides this method it has to call the base class.
36 virtual void SetEnabled(bool enabled);
38 virtual void SetMutedState(bool muted_state);
39 virtual bool GetMutedState(void) const;
41 // TODO(xians): Make this pure virtual when Stop[Track] has been
42 // implemented for remote audio tracks.
43 virtual void Stop();
45 virtual webrtc::AudioTrackInterface* GetAudioAdapter();
47 bool is_local_track () const { return is_local_track_; }
49 protected:
50 scoped_refptr<webrtc::MediaStreamTrackInterface> track_;
52 // Set to true if the owner MediaStreamSource is not delivering frames.
53 bool muted_state_;
55 private:
56 const bool is_local_track_;
58 base::ThreadChecker thread_checker_;
60 DISALLOW_COPY_AND_ASSIGN(MediaStreamTrack);
63 } // namespace content
65 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_TRACK_EXTRA_DATA_H_