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

Side by Side Diff: content/renderer/pepper/pepper_platform_audio_input_impl.h

Issue 12379071: Use multiple shared memory buffers cyclically for audio capture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: rebase Created 7 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_ 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 int sample_rate, 45 int sample_rate,
46 int frames_per_buffer, 46 int frames_per_buffer,
47 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client); 47 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client);
48 48
49 // PlatformAudioInput implementation (called on main thread). 49 // PlatformAudioInput implementation (called on main thread).
50 virtual void StartCapture() OVERRIDE; 50 virtual void StartCapture() OVERRIDE;
51 virtual void StopCapture() OVERRIDE; 51 virtual void StopCapture() OVERRIDE;
52 virtual void ShutDown() OVERRIDE; 52 virtual void ShutDown() OVERRIDE;
53 53
54 // media::AudioInputIPCDelegate. 54 // media::AudioInputIPCDelegate.
55 virtual void OnStreamCreated(base::SharedMemoryHandle handle, 55 virtual void OnStreamCreated(base::SyncSocket::Handle socket_handle,
56 base::SyncSocket::Handle socket_handle, 56 int total_handles) OVERRIDE;
57 int length) OVERRIDE; 57 virtual void OnSharedMemoryCreated(base::SharedMemoryHandle handle,
58 int length,
59 int index) OVERRIDE;
58 virtual void OnVolume(double volume) OVERRIDE; 60 virtual void OnVolume(double volume) OVERRIDE;
59 virtual void OnStateChanged( 61 virtual void OnStateChanged(
60 media::AudioInputIPCDelegate::State state) OVERRIDE; 62 media::AudioInputIPCDelegate::State state) OVERRIDE;
61 virtual void OnDeviceReady(const std::string&) OVERRIDE; 63 virtual void OnDeviceReady(const std::string&) OVERRIDE;
62 virtual void OnIPCClosed() OVERRIDE; 64 virtual void OnIPCClosed() OVERRIDE;
63 65
64 protected: 66 protected:
65 virtual ~PepperPlatformAudioInputImpl(); 67 virtual ~PepperPlatformAudioInputImpl();
66 68
67 private: 69 private:
(...skipping 21 matching lines...) Expand all
89 void NotifyStreamCreationFailed(); 91 void NotifyStreamCreationFailed();
90 92
91 // The client to notify when the stream is created. THIS MUST ONLY BE 93 // The client to notify when the stream is created. THIS MUST ONLY BE
92 // ACCESSED ON THE MAIN THREAD. 94 // ACCESSED ON THE MAIN THREAD.
93 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client_; 95 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client_;
94 96
95 // Used to send/receive IPC. THIS MUST ONLY BE ACCESSED ON THE 97 // Used to send/receive IPC. THIS MUST ONLY BE ACCESSED ON THE
96 // I/O thread except to send messages and get the message loop. 98 // I/O thread except to send messages and get the message loop.
97 scoped_refptr<AudioInputMessageFilter> ipc_; 99 scoped_refptr<AudioInputMessageFilter> ipc_;
98 100
101 base::SyncSocket::Handle socket_handle_;
102
99 // Our ID on the MessageFilter. THIS MUST ONLY BE ACCESSED ON THE I/O THREAD 103 // Our ID on the MessageFilter. THIS MUST ONLY BE ACCESSED ON THE I/O THREAD
100 // or else you could race with the initialize function which sets it. 104 // or else you could race with the initialize function which sets it.
101 int32 stream_id_; 105 int32 stream_id_;
102 106
103 // The render view into which the audio is sent. 107 // The render view into which the audio is sent.
104 int render_view_id_; 108 int render_view_id_;
105 109
106 base::MessageLoopProxy* main_message_loop_proxy_; 110 base::MessageLoopProxy* main_message_loop_proxy_;
107 111
108 // THIS MUST ONLY BE ACCESSED ON THE MAIN THREAD. 112 // THIS MUST ONLY BE ACCESSED ON THE MAIN THREAD.
109 base::WeakPtr<PepperPluginDelegateImpl> plugin_delegate_; 113 base::WeakPtr<PepperPluginDelegateImpl> plugin_delegate_;
110 114
111 // The unique ID to identify the opened device. THIS MUST ONLY BE ACCESSED ON 115 // The unique ID to identify the opened device. THIS MUST ONLY BE ACCESSED ON
112 // THE MAIN THREAD. 116 // THE MAIN THREAD.
113 std::string label_; 117 std::string label_;
114 118
115 // Whether ShutDownOnIOThread() has been called. THIS MUST ONLY BE ACCESSED ON 119 // Whether ShutDownOnIOThread() has been called. THIS MUST ONLY BE ACCESSED ON
116 // THE I/O THREAD. 120 // THE I/O THREAD.
117 bool shutdown_called_; 121 bool shutdown_called_;
118 122
119 // Initialized on the main thread and accessed on the I/O thread afterwards. 123 // Initialized on the main thread and accessed on the I/O thread afterwards.
120 media::AudioParameters params_; 124 media::AudioParameters params_;
121 125
122 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioInputImpl); 126 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioInputImpl);
123 }; 127 };
124 128
125 } // namespace content 129 } // namespace content
126 130
127 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_ 131 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698