| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_ | 6 #define CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_ |
| 7 | 7 |
| 8 #include "content/renderer/media/media_stream_audio_source.h" | 8 #include "content/renderer/media/media_stream_audio_source.h" |
| 9 #include "media/base/audio_capturer_source.h" | 9 #include "media/base/audio_capturer_source.h" |
| 10 | 10 |
| 11 namespace base { |
| 12 class SingleThreadTaskRunner; |
| 13 } |
| 14 |
| 11 namespace content { | 15 namespace content { |
| 12 | 16 |
| 13 // Represents a local source of audio data generated by an AudioInputDevice. | 17 // Represents a local source of audio data generated by an AudioInputDevice. |
| 14 // Uses content::AudioDeviceFactory to auto-create the AudioInputDevice, using | 18 // Uses content::AudioDeviceFactory to auto-create the AudioInputDevice, using |
| 15 // the parameters and session ID found in StreamDeviceInfo, just before the | 19 // the parameters and session ID found in StreamDeviceInfo, just before the |
| 16 // first track is connected. Audio data is transported directly to the tracks | 20 // first track is connected. Audio data is transported directly to the tracks |
| 17 // (i.e., there is no audio processing). | 21 // (i.e., there is no audio processing). |
| 18 class CONTENT_EXPORT LocalMediaStreamAudioSource | 22 class CONTENT_EXPORT LocalMediaStreamAudioSource |
| 19 : NON_EXPORTED_BASE(public MediaStreamAudioSource), | 23 : NON_EXPORTED_BASE(public MediaStreamAudioSource), |
| 20 NON_EXPORTED_BASE(public media::AudioCapturerSource::CaptureCallback) { | 24 NON_EXPORTED_BASE(public media::AudioCapturerSource::CaptureCallback), |
| 25 public base::SupportsWeakPtr<LocalMediaStreamAudioSource> { |
| 21 public: | 26 public: |
| 22 // |consumer_render_frame_id| references the RenderFrame that will consume the | 27 // |consumer_render_frame_id| references the RenderFrame that will consume the |
| 23 // audio data. Audio parameters and (optionally) a pre-existing audio session | 28 // audio data. Audio parameters and (optionally) a pre-existing audio session |
| 24 // ID are read from |device_info|. | 29 // ID are read from |device_info|. |
| 25 LocalMediaStreamAudioSource(int consumer_render_frame_id, | 30 LocalMediaStreamAudioSource(int consumer_render_frame_id, |
| 26 const StreamDeviceInfo& device_info); | 31 const StreamDeviceInfo& device_info); |
| 27 | 32 |
| 28 ~LocalMediaStreamAudioSource() final; | 33 ~LocalMediaStreamAudioSource() final; |
| 29 | 34 |
| 30 private: | 35 private: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 43 // AudioInputDevices via the AudioDeviceFactory. | 48 // AudioInputDevices via the AudioDeviceFactory. |
| 44 const int consumer_render_frame_id_; | 49 const int consumer_render_frame_id_; |
| 45 | 50 |
| 46 // The device created by the AudioDeviceFactory in EnsureSourceIsStarted(). | 51 // The device created by the AudioDeviceFactory in EnsureSourceIsStarted(). |
| 47 scoped_refptr<media::AudioCapturerSource> source_; | 52 scoped_refptr<media::AudioCapturerSource> source_; |
| 48 | 53 |
| 49 // In debug builds, check that all methods that could cause object graph | 54 // In debug builds, check that all methods that could cause object graph |
| 50 // or data flow changes are being called on the main thread. | 55 // or data flow changes are being called on the main thread. |
| 51 base::ThreadChecker thread_checker_; | 56 base::ThreadChecker thread_checker_; |
| 52 | 57 |
| 58 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 59 |
| 53 DISALLOW_COPY_AND_ASSIGN(LocalMediaStreamAudioSource); | 60 DISALLOW_COPY_AND_ASSIGN(LocalMediaStreamAudioSource); |
| 54 }; | 61 }; |
| 55 | 62 |
| 56 } // namespace content | 63 } // namespace content |
| 57 | 64 |
| 58 #endif // CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_ | 65 #endif // CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_ |
| OLD | NEW |