| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // An AudioInputStream which provides a loop-back of all audio output generated | 5 // An AudioInputStream which provides a loop-back of all audio output generated |
| 6 // by the entire RenderFrame tree associated with a WebContents instance. The | 6 // by the entire RenderFrame tree associated with a WebContents instance. The |
| 7 // single stream of data is produced by format-converting and mixing all audio | 7 // single stream of data is produced by format-converting and mixing all audio |
| 8 // output streams. As the RenderFrameHost tree mutates (e.g., due to page | 8 // output streams. As the RenderFrameHost tree mutates (e.g., due to page |
| 9 // navigations, or crashes/reloads), the stream will continue without | 9 // navigations, or crashes/reloads), the stream will continue without |
| 10 // interruption. In other words, WebContentsAudioInputStream provides tab-level | 10 // interruption. In other words, WebContentsAudioInputStream provides tab-level |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // WebContentsCaptureUtil::ExtractTabCaptureTarget(). The caller must | 54 // WebContentsCaptureUtil::ExtractTabCaptureTarget(). The caller must |
| 55 // guarantee Close() is called on the returned object so that it may | 55 // guarantee Close() is called on the returned object so that it may |
| 56 // self-destruct. | 56 // self-destruct. |
| 57 // |worker_task_runner| is the task runner on which AudioInputCallback methods | 57 // |worker_task_runner| is the task runner on which AudioInputCallback methods |
| 58 // are called and may or may not be the single thread that invokes the | 58 // are called and may or may not be the single thread that invokes the |
| 59 // AudioInputStream methods. | 59 // AudioInputStream methods. |
| 60 static WebContentsAudioInputStream* Create( | 60 static WebContentsAudioInputStream* Create( |
| 61 const std::string& device_id, | 61 const std::string& device_id, |
| 62 const media::AudioParameters& params, | 62 const media::AudioParameters& params, |
| 63 const scoped_refptr<base::SingleThreadTaskRunner>& worker_task_runner, | 63 const scoped_refptr<base::SingleThreadTaskRunner>& worker_task_runner, |
| 64 AudioMirroringManager* audio_mirroring_manager, | 64 AudioMirroringManager* audio_mirroring_manager); |
| 65 bool is_duplication); | |
| 66 | 65 |
| 67 private: | 66 private: |
| 68 friend class WebContentsAudioInputStreamTest; | 67 friend class WebContentsAudioInputStreamTest; |
| 69 | 68 |
| 70 // Maintain most state and functionality in an internal ref-counted | 69 // Maintain most state and functionality in an internal ref-counted |
| 71 // implementation class. This object must outlive a call to Close(), until | 70 // implementation class. This object must outlive a call to Close(), until |
| 72 // the shutdown tasks running on other threads complete: The | 71 // the shutdown tasks running on other threads complete: The |
| 73 // AudioMirroringManager on the IO thread, the WebContentsTracker on the UI | 72 // AudioMirroringManager on the IO thread, the WebContentsTracker on the UI |
| 74 // thread, and the VirtualAudioOuputStreams on the audio thread. | 73 // thread, and the VirtualAudioOuputStreams on the audio thread. |
| 75 class Impl; | 74 class Impl; |
| 76 | 75 |
| 77 WebContentsAudioInputStream(int render_process_id, | 76 WebContentsAudioInputStream(int render_process_id, |
| 78 int main_render_frame_id, | 77 int main_render_frame_id, |
| 79 AudioMirroringManager* mirroring_manager, | 78 AudioMirroringManager* mirroring_manager, |
| 80 const scoped_refptr<WebContentsTracker>& tracker, | 79 const scoped_refptr<WebContentsTracker>& tracker, |
| 81 media::VirtualAudioInputStream* mixer_stream, | 80 media::VirtualAudioInputStream* mixer_stream, |
| 82 bool is_duplication); | 81 bool is_duplication); |
| 83 | 82 |
| 84 ~WebContentsAudioInputStream() override; | 83 ~WebContentsAudioInputStream() override; |
| 85 | 84 |
| 86 scoped_refptr<Impl> impl_; | 85 scoped_refptr<Impl> impl_; |
| 87 | 86 |
| 88 DISALLOW_COPY_AND_ASSIGN(WebContentsAudioInputStream); | 87 DISALLOW_COPY_AND_ASSIGN(WebContentsAudioInputStream); |
| 89 }; | 88 }; |
| 90 | 89 |
| 91 } // namespace content | 90 } // namespace content |
| 92 | 91 |
| 93 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_AUDIO_INPUT_STREAM_H_ | 92 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_AUDIO_INPUT_STREAM_H_ |
| OLD | NEW |