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

Side by Side Diff: content/renderer/media/audio_device.h

Issue 7631033: Very early implementation for HTMLMediaElement / Web Audio API integration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/media/audio_renderer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Low-latency audio rendering unit utilizing audio output stream provided 5 // Low-latency audio rendering unit utilizing audio output stream provided
6 // by browser process through IPC. 6 // by browser process through IPC.
7 // 7 //
8 // Relationship of classes. 8 // Relationship of classes.
9 // 9 //
10 // AudioOutputController AudioDevice 10 // AudioOutputController AudioDevice
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #define CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_H_ 47 #define CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_H_
48 #pragma once 48 #pragma once
49 49
50 #include <vector> 50 #include <vector>
51 51
52 #include "base/basictypes.h" 52 #include "base/basictypes.h"
53 #include "base/memory/scoped_ptr.h" 53 #include "base/memory/scoped_ptr.h"
54 #include "base/shared_memory.h" 54 #include "base/shared_memory.h"
55 #include "base/threading/simple_thread.h" 55 #include "base/threading/simple_thread.h"
56 #include "content/renderer/media/audio_message_filter.h" 56 #include "content/renderer/media/audio_message_filter.h"
57 #include "media/filters/audio_renderer_sink.h"
57 58
58 struct AudioParameters; 59 struct AudioParameters;
59 60
60 class AudioDevice 61 class AudioDevice
61 : public AudioMessageFilter::Delegate, 62 : public AudioMessageFilter::Delegate,
62 public base::DelegateSimpleThread::Delegate, 63 public base::DelegateSimpleThread::Delegate,
63 public base::RefCountedThreadSafe<AudioDevice> { 64 public media::AudioRendererSink {
64 public: 65 public:
65 class RenderCallback {
66 public:
67 virtual void Render(const std::vector<float*>& audio_data,
68 size_t number_of_frames,
69 size_t audio_delay_milliseconds) = 0;
70 protected:
71 virtual ~RenderCallback() {}
72 };
73 66
74 // Methods called on main render thread ------------------------------------- 67 // Methods called on main render thread -------------------------------------
75 AudioDevice(size_t buffer_size, 68 AudioDevice(size_t buffer_size,
76 int channels, 69 int channels,
77 double sample_rate, 70 double sample_rate,
78 RenderCallback* callback); 71 RenderCallback* callback);
79 virtual ~AudioDevice(); 72 virtual ~AudioDevice();
80 73
81 // Starts audio playback. Returns |true| on success. 74 // Starts audio playback. Returns |true| on success.
82 bool Start(); 75 virtual bool Start();
83 76
84 // Stops audio playback. Returns |true| on success. 77 // Stops audio playback. Returns |true| on success.
85 bool Stop(); 78 virtual bool Stop();
86 79
87 // Sets the playback volume, with range [0.0, 1.0] inclusive. 80 // Sets the playback volume, with range [0.0, 1.0] inclusive.
88 // Returns |true| on success. 81 // Returns |true| on success.
89 bool SetVolume(double volume); 82 virtual bool SetVolume(double volume);
90 83
91 // Gets the playback volume, with range [0.0, 1.0] inclusive. 84 // Gets the playback volume, with range [0.0, 1.0] inclusive.
92 // Returns |true| on success. 85 // Returns |true| on success.
93 bool GetVolume(double* volume); 86 bool GetVolume(double* volume);
94 87
95 double sample_rate() const { return sample_rate_; } 88 double sample_rate() const { return sample_rate_; }
96 size_t buffer_size() const { return buffer_size_; } 89 size_t buffer_size() const { return buffer_size_; }
97 90
98 static double GetAudioHardwareSampleRate(); 91 static double GetAudioHardwareSampleRate();
99 92
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 155
163 // Data transfer between browser and render process uses a combination 156 // Data transfer between browser and render process uses a combination
164 // of sync sockets and shared memory to provide lowest possible latency. 157 // of sync sockets and shared memory to provide lowest possible latency.
165 scoped_ptr<base::SharedMemory> shared_memory_; 158 scoped_ptr<base::SharedMemory> shared_memory_;
166 scoped_ptr<base::SyncSocket> socket_; 159 scoped_ptr<base::SyncSocket> socket_;
167 160
168 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioDevice); 161 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioDevice);
169 }; 162 };
170 163
171 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_H_ 164 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_H_
OLDNEW
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/media/audio_renderer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698