OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_AUDIO_TRACK_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_H_ |
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // format change. In turn, all MediaStreamAudioSinks will be notified before | 85 // format change. In turn, all MediaStreamAudioSinks will be notified before |
86 // the next chunk of audio is delivered to them. | 86 // the next chunk of audio is delivered to them. |
87 void OnSetFormat(const media::AudioParameters& params); | 87 void OnSetFormat(const media::AudioParameters& params); |
88 | 88 |
89 // Called by the MediaStreamAudioDeliverer to deliver audio data to this | 89 // Called by the MediaStreamAudioDeliverer to deliver audio data to this |
90 // track, which in turn delivers the audio to one or more | 90 // track, which in turn delivers the audio to one or more |
91 // MediaStreamAudioSinks. While this track is disabled, silent audio will be | 91 // MediaStreamAudioSinks. While this track is disabled, silent audio will be |
92 // delivered to the sinks instead of the content of |audio_bus|. | 92 // delivered to the sinks instead of the content of |audio_bus|. |
93 void OnData(const media::AudioBus& audio_bus, base::TimeTicks reference_time); | 93 void OnData(const media::AudioBus& audio_bus, base::TimeTicks reference_time); |
94 | 94 |
95 void GetSettings(blink::WebMediaStreamTrack::Settings& settings) override; | |
96 | |
97 private: | 95 private: |
98 // In debug builds, check that all methods that could cause object graph | 96 // In debug builds, check that all methods that could cause object graph |
99 // or data flow changes are being called on the main thread. | 97 // or data flow changes are being called on the main thread. |
100 base::ThreadChecker thread_checker_; | 98 base::ThreadChecker thread_checker_; |
101 | 99 |
102 // Callback provided to Start() which is run when the audio flow must halt. | 100 // Callback provided to Start() which is run when the audio flow must halt. |
103 base::Closure stop_callback_; | 101 base::Closure stop_callback_; |
104 | 102 |
105 // Manages sinks connected to this track and the audio format and data flow. | 103 // Manages sinks connected to this track and the audio format and data flow. |
106 MediaStreamAudioDeliverer<MediaStreamAudioSink> deliverer_; | 104 MediaStreamAudioDeliverer<MediaStreamAudioSink> deliverer_; |
107 | 105 |
108 // While false (0), silent audio is delivered to the sinks. | 106 // While false (0), silent audio is delivered to the sinks. |
109 base::subtle::Atomic32 is_enabled_; | 107 base::subtle::Atomic32 is_enabled_; |
110 | 108 |
111 // Buffer used to deliver silent audio data while this track is disabled. | 109 // Buffer used to deliver silent audio data while this track is disabled. |
112 std::unique_ptr<media::AudioBus> silent_bus_; | 110 std::unique_ptr<media::AudioBus> silent_bus_; |
113 | 111 |
114 // Provides weak pointers that are valid until Stop() is called. | 112 // Provides weak pointers that are valid until Stop() is called. |
115 base::WeakPtrFactory<MediaStreamAudioTrack> weak_factory_; | 113 base::WeakPtrFactory<MediaStreamAudioTrack> weak_factory_; |
116 | 114 |
117 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioTrack); | 115 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioTrack); |
118 }; | 116 }; |
119 | 117 |
120 } // namespace content | 118 } // namespace content |
121 | 119 |
122 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_H_ | 120 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_H_ |
OLD | NEW |