OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_TRACK_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_TRACK_H_ |
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_TRACK_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_TRACK_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/threading/thread_checker.h" | 9 #include "base/threading/thread_checker.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "media/audio/audio_parameters.h" | |
11 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 12 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
12 | 13 |
13 namespace webrtc { | 14 namespace webrtc { |
14 class AudioTrackInterface; | 15 class AudioTrackInterface; |
15 } // namespace webrtc | 16 } // namespace webrtc |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
20 class MediaStreamAudioSink; | |
21 | |
19 // MediaStreamTrack is a Chrome representation of blink::WebMediaStreamTrack. | 22 // MediaStreamTrack is a Chrome representation of blink::WebMediaStreamTrack. |
20 // It is owned by blink::WebMediaStreamTrack as | 23 // It is owned by blink::WebMediaStreamTrack as |
21 // blink::WebMediaStreamTrack::ExtraData. | 24 // blink::WebMediaStreamTrack::ExtraData. |
22 class CONTENT_EXPORT MediaStreamTrack | 25 class CONTENT_EXPORT MediaStreamTrack |
23 : NON_EXPORTED_BASE(public blink::WebMediaStreamTrack::ExtraData) { | 26 : NON_EXPORTED_BASE(public blink::WebMediaStreamTrack::ExtraData) { |
24 public: | 27 public: |
25 explicit MediaStreamTrack(bool is_local_track); | 28 explicit MediaStreamTrack(bool is_local_track); |
26 ~MediaStreamTrack() override; | 29 ~MediaStreamTrack() override; |
27 | 30 |
28 static MediaStreamTrack* GetTrack(const blink::WebMediaStreamTrack& track); | 31 static MediaStreamTrack* GetTrack(const blink::WebMediaStreamTrack& track); |
29 | 32 |
30 virtual void SetEnabled(bool enabled) = 0; | 33 virtual void SetEnabled(bool enabled) = 0; |
31 | 34 |
32 virtual void Stop() = 0; | 35 virtual void Stop() = 0; |
33 | 36 |
34 // TODO(tommi, xians): Remove this method. | |
35 virtual webrtc::AudioTrackInterface* GetAudioAdapter(); | |
36 | |
37 bool is_local_track() const { return is_local_track_; } | 37 bool is_local_track() const { return is_local_track_; } |
38 | 38 |
39 protected: | 39 protected: |
40 const bool is_local_track_; | 40 const bool is_local_track_; |
41 | 41 |
42 // Used to DCHECK that we are called on Render main Thread. | 42 // Used to DCHECK that we are called on Render main Thread. |
43 base::ThreadChecker main_render_thread_checker_; | 43 base::ThreadChecker main_render_thread_checker_; |
44 | 44 |
45 private: | |
45 DISALLOW_COPY_AND_ASSIGN(MediaStreamTrack); | 46 DISALLOW_COPY_AND_ASSIGN(MediaStreamTrack); |
46 }; | 47 }; |
47 | 48 |
49 class CONTENT_EXPORT MediaStreamAudioTrack : public MediaStreamTrack { | |
perkj_chrome
2015/12/11 12:31:38
please move to separate file. See MediaStreamVideo
tommi (sloooow) - chröme
2015/12/11 15:36:51
Done.
| |
50 public: | |
51 explicit MediaStreamAudioTrack(bool is_local_track); | |
52 ~MediaStreamAudioTrack() override; | |
53 | |
54 static MediaStreamAudioTrack* GetTrack( | |
55 const blink::WebMediaStreamTrack& track); | |
56 | |
57 // Add a sink to the track. This function will trigger a OnSetFormat() | |
58 // call on the |sink|. | |
59 // Called on the main render thread. | |
60 virtual void AddSink(MediaStreamAudioSink* sink) = 0; | |
61 | |
62 // Remove a sink from the track. | |
63 // Called on the main render thread. | |
64 virtual void RemoveSink(MediaStreamAudioSink* sink) = 0; | |
65 | |
66 // TODO(tommi, xians): Remove this method. | |
67 virtual webrtc::AudioTrackInterface* GetAudioAdapter(); | |
68 | |
69 // Returns the output format of the capture source. May return an invalid | |
70 // AudioParameters if the format is not yet available. | |
71 // Called on the main render thread. | |
72 virtual media::AudioParameters GetOutputFormat() const = 0; | |
73 | |
74 private: | |
75 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioTrack); | |
76 }; | |
77 | |
48 } // namespace content | 78 } // namespace content |
49 | 79 |
50 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_TRACK_H_ | 80 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_TRACK_H_ |
OLD | NEW |