Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: content/browser/renderer_host/media/web_contents_audio_input_stream.h

Issue 17334005: Re-land r207105 (Mac audio capture threading fix) with unit test memory leak issue resolved. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Using ref-counting (Patch Set 2 from Issue 17122006). Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 RenderView associated with a WebContents instance. The single stream 6 // by the RenderView associated with a WebContents instance. The single stream
7 // of data is produced by format-converting and mixing all audio output from a 7 // of data is produced by format-converting and mixing all audio output from a
8 // RenderView. In other words, WebContentsAudioInputStream provides tab-level 8 // RenderView. In other words, WebContentsAudioInputStream provides tab-level
9 // audio mirroring. 9 // audio mirroring.
10 // 10 //
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 virtual void SetVolume(double volume) OVERRIDE; 48 virtual void SetVolume(double volume) OVERRIDE;
49 virtual double GetVolume() OVERRIDE; 49 virtual double GetVolume() OVERRIDE;
50 virtual void SetAutomaticGainControl(bool enabled) OVERRIDE; 50 virtual void SetAutomaticGainControl(bool enabled) OVERRIDE;
51 virtual bool GetAutomaticGainControl() OVERRIDE; 51 virtual bool GetAutomaticGainControl() OVERRIDE;
52 52
53 // Create a new audio mirroring session, or return NULL on error. |device_id| 53 // Create a new audio mirroring session, or return NULL on error. |device_id|
54 // should be in the format accepted by 54 // should be in the format accepted by
55 // WebContentsCaptureUtil::ExtractTabCaptureTarget(). The caller must 55 // WebContentsCaptureUtil::ExtractTabCaptureTarget(). The caller must
56 // guarantee Close() is called on the returned object so that it may 56 // guarantee Close() is called on the returned object so that it may
57 // self-destruct. 57 // self-destruct.
58 // |worker_loop| is the loop on which AudioInputCallback methods are called
59 // and may or may not be the single thread that invokes the AudioInputStream
60 // methods.
58 static WebContentsAudioInputStream* Create( 61 static WebContentsAudioInputStream* Create(
59 const std::string& device_id, 62 const std::string& device_id,
60 const media::AudioParameters& params, 63 const media::AudioParameters& params,
61 const scoped_refptr<base::MessageLoopProxy>& message_loop, 64 const scoped_refptr<base::MessageLoopProxy>& worker_loop,
62 AudioMirroringManager* audio_mirroring_manager); 65 AudioMirroringManager* audio_mirroring_manager);
63 66
64 private: 67 private:
65 friend class WebContentsAudioInputStreamTest; 68 friend class WebContentsAudioInputStreamTest;
66 69
67 // Maintain most state and functionality in an internal ref-counted 70 // Maintain most state and functionality in an internal ref-counted
68 // implementation class. This object must outlive a call to Close(), until 71 // implementation class. This object must outlive a call to Close(), until
69 // the shutdown tasks running on other threads complete: The 72 // the shutdown tasks running on other threads complete: The
70 // AudioMirroringManager on the IO thread, the WebContentsTracker on the UI 73 // AudioMirroringManager on the IO thread, the WebContentsTracker on the UI
71 // thread, and the VirtualAudioOuputStreams on the audio thread. 74 // thread, and the VirtualAudioOuputStreams on the audio thread.
72 class Impl; 75 class Impl;
73 76
74 WebContentsAudioInputStream( 77 WebContentsAudioInputStream(
75 int render_process_id, int render_view_id, 78 int render_process_id, int render_view_id,
76 const scoped_refptr<base::MessageLoopProxy>& message_loop,
77 AudioMirroringManager* mirroring_manager, 79 AudioMirroringManager* mirroring_manager,
78 const scoped_refptr<WebContentsTracker>& tracker, 80 const scoped_refptr<WebContentsTracker>& tracker,
79 media::VirtualAudioInputStream* mixer_stream); 81 media::VirtualAudioInputStream* mixer_stream);
80 82
81 virtual ~WebContentsAudioInputStream(); 83 virtual ~WebContentsAudioInputStream();
82 84
83 scoped_refptr<Impl> impl_; 85 scoped_refptr<Impl> impl_;
84 86
85 DISALLOW_COPY_AND_ASSIGN(WebContentsAudioInputStream); 87 DISALLOW_COPY_AND_ASSIGN(WebContentsAudioInputStream);
86 }; 88 };
87 89
88 } // namespace content 90 } // namespace content
89 91
90 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_AUDIO_INPUT_STREAM_H _ 92 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_AUDIO_INPUT_STREAM_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698