Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_ | |
| 6 #define CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_ | |
| 7 | |
| 8 #include "content/renderer/media/media_stream_audio_source.h" | |
| 9 #include "media/base/audio_capturer_source.h" | |
| 10 | |
| 11 namespace content { | |
| 12 | |
| 13 // Represents a local source of audio data generated by an AudioInputDevice. | |
| 14 // Uses content::AudioDeviceFactory to auto-create the AudioInputDevice, using | |
| 15 // the parameters and session ID found in StreamDeviceInfo, just before the | |
| 16 // first track is connected. Audio data is transported directly to the tracks | |
| 17 // (i.e., there is no audio processing). | |
| 18 class CONTENT_EXPORT LocalMediaStreamAudioSource | |
|
o1ka
2016/08/15 15:15:00
Should probably the naming match ProcessedLocalAud
miu
2016/08/16 04:30:02
I don't know if it's necessary to call-out in its
o1ka
2016/08/16 14:18:11
I just find it easier to read the code when naming
miu
2016/08/16 20:13:39
I can understand this concern. FWIW, the other two
| |
| 19 : NON_EXPORTED_BASE(public MediaStreamAudioSource), | |
| 20 NON_EXPORTED_BASE(public media::AudioCapturerSource::CaptureCallback) { | |
| 21 public: | |
| 22 // |consumer_render_frame_id| references the RenderFrame that will consume the | |
| 23 // audio data. Audio parameters and (optionally) a pre-existing audio session | |
| 24 // ID are read from |device_info|. | |
| 25 LocalMediaStreamAudioSource(int consumer_render_frame_id, | |
| 26 const StreamDeviceInfo& device_info); | |
| 27 | |
| 28 ~LocalMediaStreamAudioSource() final; | |
| 29 | |
| 30 private: | |
| 31 // MediaStreamAudioSource implementation. | |
| 32 bool EnsureSourceIsStarted() final; | |
| 33 void EnsureSourceIsStopped() final; | |
| 34 | |
| 35 // media::AudioCapturerSource::CaptureCallback implementation. | |
| 36 void Capture(const media::AudioBus* audio_bus, | |
| 37 int audio_delay_milliseconds, | |
| 38 double volume, | |
| 39 bool key_pressed) final; | |
| 40 void OnCaptureError(const std::string& message) final; | |
| 41 | |
| 42 // The RenderFrame that will consume the audio data. Used when creating | |
| 43 // AudioInputDevices via the AudioDeviceFactory. | |
| 44 const int consumer_render_frame_id_; | |
| 45 | |
| 46 // The device created by the AudioDeviceFactory in EnsureSourceIsStarted(). | |
| 47 scoped_refptr<media::AudioCapturerSource> source_; | |
| 48 | |
| 49 // In debug builds, check that all methods that could cause object graph | |
| 50 // or data flow changes are being called on the main thread. | |
| 51 base::ThreadChecker thread_checker_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(LocalMediaStreamAudioSource); | |
| 54 }; | |
| 55 | |
| 56 } // namespace content | |
| 57 | |
| 58 #endif // CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_ | |
| OLD | NEW |