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

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

Issue 314713002: Modifies AudioInputCallback::OnData and use media::AudioBus instead of plain byte vector (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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) 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_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_SYNC_WRITER_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_SYNC_WRITER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_SYNC_WRITER_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_SYNC_WRITER_H_
7 7
8 #include "base/process/process.h" 8 #include "base/process/process.h"
9 #include "base/sync_socket.h" 9 #include "base/sync_socket.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "media/audio/audio_input_controller.h" 11 #include "media/audio/audio_input_controller.h"
12 #include "media/audio/audio_parameters.h"
12 13
13 #if defined(OS_POSIX) 14 #if defined(OS_POSIX)
14 #include "base/file_descriptor_posix.h" 15 #include "base/file_descriptor_posix.h"
15 #endif 16 #endif
16 17
17 namespace base { 18 namespace base {
18 class SharedMemory; 19 class SharedMemory;
19 } 20 }
20 21
22 namespace media {
23 class AudioBus;
24 }
25
21 namespace content { 26 namespace content {
22 // A AudioInputController::SyncWriter implementation using SyncSocket. This 27 // A AudioInputController::SyncWriter implementation using SyncSocket. This
23 // is used by AudioInputController to provide a low latency data source for 28 // is used by AudioInputController to provide a low latency data source for
24 // transmitting audio packets between the browser process and the renderer 29 // transmitting audio packets between the browser process and the renderer
25 // process. 30 // process.
26 class AudioInputSyncWriter : public media::AudioInputController::SyncWriter { 31 class AudioInputSyncWriter : public media::AudioInputController::SyncWriter {
27 public: 32 public:
28 explicit AudioInputSyncWriter(base::SharedMemory* shared_memory, 33 explicit AudioInputSyncWriter(base::SharedMemory* shared_memory,
29 int shared_memory_segment_count); 34 int shared_memory_segment_count,
35 const media::AudioParameters& params);
30 36
31 virtual ~AudioInputSyncWriter(); 37 virtual ~AudioInputSyncWriter();
32 38
33 // media::AudioOutputController::SyncWriter implementation. 39 // media::AudioOutputController::SyncWriter implementation.
34 virtual void UpdateRecordedBytes(uint32 bytes) OVERRIDE; 40 virtual void UpdateRecordedBytes(uint32 bytes) OVERRIDE;
35 virtual uint32 Write(const void* data, 41 virtual uint32 Write(const media::AudioBus* data,
36 uint32 size,
37 double volume, 42 double volume,
38 bool key_pressed) OVERRIDE; 43 bool key_pressed) OVERRIDE;
39 virtual void Close() OVERRIDE; 44 virtual void Close() OVERRIDE;
40 45
41 bool Init(); 46 bool Init();
42 bool PrepareForeignSocketHandle(base::ProcessHandle process_handle, 47 bool PrepareForeignSocketHandle(base::ProcessHandle process_handle,
43 #if defined(OS_WIN) 48 #if defined(OS_WIN)
44 base::SyncSocket::Handle* foreign_handle); 49 base::SyncSocket::Handle* foreign_handle);
45 #else 50 #else
46 base::FileDescriptor* foreign_handle); 51 base::FileDescriptor* foreign_handle);
(...skipping 11 matching lines...) Expand all
58 // Socket to be used by the renderer. The reference is released after 63 // Socket to be used by the renderer. The reference is released after
59 // PrepareForeignSocketHandle() is called and ran successfully. 64 // PrepareForeignSocketHandle() is called and ran successfully.
60 scoped_ptr<base::CancelableSyncSocket> foreign_socket_; 65 scoped_ptr<base::CancelableSyncSocket> foreign_socket_;
61 66
62 // The time of the creation of this object. 67 // The time of the creation of this object.
63 base::Time creation_time_; 68 base::Time creation_time_;
64 69
65 // The time of the last Write call. 70 // The time of the last Write call.
66 base::Time last_write_time_; 71 base::Time last_write_time_;
67 72
73 media::AudioParameters params_;
74
68 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputSyncWriter); 75 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputSyncWriter);
69 }; 76 };
70 77
71 } // namespace content 78 } // namespace content
72 79
73 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_SYNC_WRITER_H_ 80 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_SYNC_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698