| OLD | NEW |
| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <deque> | 11 #include <deque> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <string> |
| 13 #include <vector> | 14 #include <vector> |
| 14 | 15 |
| 15 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 16 #include "base/macros.h" | 17 #include "base/macros.h" |
| 17 #include "base/process/process.h" | 18 #include "base/process/process.h" |
| 18 #include "base/sync_socket.h" | 19 #include "base/sync_socket.h" |
| 19 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 20 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 21 #include "content/common/content_export.h" | 22 #include "content/common/content_export.h" |
| 22 #include "media/audio/audio_input_controller.h" | 23 #include "media/audio/audio_input_controller.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // Counts the total number of calls to Write(). | 136 // Counts the total number of calls to Write(). |
| 136 size_t write_count_; | 137 size_t write_count_; |
| 137 | 138 |
| 138 // Counts the number of writes to the fifo instead of to the shared memory. | 139 // Counts the number of writes to the fifo instead of to the shared memory. |
| 139 size_t write_to_fifo_count_; | 140 size_t write_to_fifo_count_; |
| 140 | 141 |
| 141 // Counts the number of errors that causes data to be dropped, due to either | 142 // Counts the number of errors that causes data to be dropped, due to either |
| 142 // the fifo or the socket buffer being full. | 143 // the fifo or the socket buffer being full. |
| 143 size_t write_error_count_; | 144 size_t write_error_count_; |
| 144 | 145 |
| 146 // Denotes that the most recent socket error has been logged. Used to avoid |
| 147 // log spam. |
| 148 bool had_socket_error_; |
| 149 |
| 145 // Counts the fifo writes and errors we get during renderer process teardown | 150 // Counts the fifo writes and errors we get during renderer process teardown |
| 146 // so that we can account for that (subtract) when we calculate the overall | 151 // so that we can account for that (subtract) when we calculate the overall |
| 147 // counts. | 152 // counts. |
| 148 size_t trailing_write_to_fifo_count_; | 153 size_t trailing_write_to_fifo_count_; |
| 149 size_t trailing_write_error_count_; | 154 size_t trailing_write_error_count_; |
| 150 | 155 |
| 151 // Vector of audio buses allocated during construction and deleted in the | 156 // Vector of audio buses allocated during construction and deleted in the |
| 152 // destructor. | 157 // destructor. |
| 153 std::vector<std::unique_ptr<media::AudioBus>> audio_buses_; | 158 std::vector<std::unique_ptr<media::AudioBus>> audio_buses_; |
| 154 | 159 |
| 155 // Fifo for audio that is used in case there isn't room in the shared memory. | 160 // Fifo for audio that is used in case there isn't room in the shared memory. |
| 156 // This can for example happen under load when the consumer side is starved. | 161 // This can for example happen under load when the consumer side is starved. |
| 157 // It should ideally be rare, but we need to guarantee that the data arrives | 162 // It should ideally be rare, but we need to guarantee that the data arrives |
| 158 // since audio processing such as echo cancelling requires that to perform | 163 // since audio processing such as echo cancelling requires that to perform |
| 159 // properly. | 164 // properly. |
| 160 std::vector<std::unique_ptr<media::AudioBus>> overflow_buses_; | 165 std::vector<std::unique_ptr<media::AudioBus>> overflow_buses_; |
| 161 struct OverflowParams { | 166 struct OverflowParams { |
| 162 double volume; | 167 double volume; |
| 163 uint32_t hardware_delay_bytes; | 168 uint32_t hardware_delay_bytes; |
| 164 bool key_pressed; | 169 bool key_pressed; |
| 165 }; | 170 }; |
| 166 std::deque<OverflowParams> overflow_params_; | 171 std::deque<OverflowParams> overflow_params_; |
| 167 | 172 |
| 168 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputSyncWriter); | 173 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputSyncWriter); |
| 169 }; | 174 }; |
| 170 | 175 |
| 171 } // namespace content | 176 } // namespace content |
| 172 | 177 |
| 173 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_SYNC_WRITER_H_ | 178 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_SYNC_WRITER_H_ |
| OLD | NEW |