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

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

Issue 1293503002: Check buffer index in shared memory for input audio. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Now the Win compile error should really be fixed. Created 5 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
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/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/process/process.h" 9 #include "base/process/process.h"
10 #include "base/sync_socket.h" 10 #include "base/sync_socket.h"
(...skipping 17 matching lines...) Expand all
28 // process. 28 // process.
29 class AudioInputSyncWriter : public media::AudioInputController::SyncWriter { 29 class AudioInputSyncWriter : public media::AudioInputController::SyncWriter {
30 public: 30 public:
31 explicit AudioInputSyncWriter(base::SharedMemory* shared_memory, 31 explicit AudioInputSyncWriter(base::SharedMemory* shared_memory,
32 int shared_memory_segment_count, 32 int shared_memory_segment_count,
33 const media::AudioParameters& params); 33 const media::AudioParameters& params);
34 34
35 ~AudioInputSyncWriter() override; 35 ~AudioInputSyncWriter() override;
36 36
37 // media::AudioInputController::SyncWriter implementation. 37 // media::AudioInputController::SyncWriter implementation.
38 void UpdateRecordedBytes(uint32 bytes) override;
39 void Write(const media::AudioBus* data, 38 void Write(const media::AudioBus* data,
40 double volume, 39 double volume,
41 bool key_pressed) override; 40 bool key_pressed,
41 uint32 hardware_delay_bytes) override;
42 void Close() override; 42 void Close() override;
43 43
44 bool Init(); 44 bool Init();
45 bool PrepareForeignSocket(base::ProcessHandle process_handle, 45 bool PrepareForeignSocket(base::ProcessHandle process_handle,
46 base::SyncSocket::TransitDescriptor* descriptor); 46 base::SyncSocket::TransitDescriptor* descriptor);
47 47
48 private: 48 private:
49 base::SharedMemory* shared_memory_; 49 base::SharedMemory* shared_memory_;
50 uint32 shared_memory_segment_size_; 50 uint32 shared_memory_segment_size_;
51 uint32 shared_memory_segment_count_; 51 uint32 shared_memory_segment_count_;
52 uint32 current_segment_id_; 52 uint32 current_segment_id_;
53 53
54 // Socket for transmitting audio data. 54 // Socket for transmitting audio data.
55 scoped_ptr<base::CancelableSyncSocket> socket_; 55 scoped_ptr<base::CancelableSyncSocket> socket_;
56 56
57 // Socket to be used by the renderer. The reference is released after 57 // Socket to be used by the renderer. The reference is released after
58 // PrepareForeignSocketHandle() is called and ran successfully. 58 // PrepareForeignSocketHandle() is called and ran successfully.
59 scoped_ptr<base::CancelableSyncSocket> foreign_socket_; 59 scoped_ptr<base::CancelableSyncSocket> foreign_socket_;
60 60
61 // The time of the creation of this object. 61 // The time of the creation of this object.
62 base::Time creation_time_; 62 base::Time creation_time_;
63 63
64 // The time of the last Write call. 64 // The time of the last Write call.
65 base::Time last_write_time_; 65 base::Time last_write_time_;
66 66
67 // Size in bytes of each audio bus. 67 // Size in bytes of each audio bus.
68 const int audio_bus_memory_size_; 68 const int audio_bus_memory_size_;
69 69
70 // Increasing ID used for audio buffers correct sequence at read side.
71 uint32_t next_buffer_id_;
72
70 // Vector of audio buses allocated during construction and deleted in the 73 // Vector of audio buses allocated during construction and deleted in the
71 // destructor. 74 // destructor.
72 ScopedVector<media::AudioBus> audio_buses_; 75 ScopedVector<media::AudioBus> audio_buses_;
73 76
74 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputSyncWriter); 77 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputSyncWriter);
75 }; 78 };
76 79
77 } // namespace content 80 } // namespace content
78 81
79 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_SYNC_WRITER_H_ 82 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_SYNC_WRITER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/audio_input_sync_writer.cc » ('j') | media/audio/audio_parameters.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698