| 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 #include "content/browser/renderer_host/media/audio_input_sync_writer.h" | 5 #include "content/browser/renderer_host/media/audio_input_sync_writer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/format_macros.h" |
| 9 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 12 #include "content/browser/renderer_host/media/media_stream_manager.h" | 13 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 14 | 15 |
| 15 using media::AudioBus; | 16 using media::AudioBus; |
| 16 using media::AudioInputBuffer; | 17 using media::AudioInputBuffer; |
| 17 using media::AudioInputBufferParameters; | 18 using media::AudioInputBufferParameters; |
| 18 | 19 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 "Media.AudioCapturerDroppedData", | 102 "Media.AudioCapturerDroppedData", |
| 102 100.0 * write_error_count_ / write_count_); | 103 100.0 * write_error_count_ / write_count_); |
| 103 | 104 |
| 104 UMA_HISTOGRAM_ENUMERATION("Media.AudioCapturerAudioGlitches", | 105 UMA_HISTOGRAM_ENUMERATION("Media.AudioCapturerAudioGlitches", |
| 105 write_error_count_ == 0 ? | 106 write_error_count_ == 0 ? |
| 106 AUDIO_CAPTURER_NO_AUDIO_GLITCHES : | 107 AUDIO_CAPTURER_NO_AUDIO_GLITCHES : |
| 107 AUDIO_CAPTURER_AUDIO_GLITCHES, | 108 AUDIO_CAPTURER_AUDIO_GLITCHES, |
| 108 AUDIO_CAPTURER_AUDIO_GLITCHES_MAX + 1); | 109 AUDIO_CAPTURER_AUDIO_GLITCHES_MAX + 1); |
| 109 | 110 |
| 110 std::string log_string = base::StringPrintf( | 111 std::string log_string = base::StringPrintf( |
| 111 #if defined(COMPILER_MSVC) | 112 "AISW: number of detected audio glitches: %" PRIuS " out of %" PRIuS, |
| 112 "AISW: number of detected audio glitches: %Iu out of %Iu", | 113 write_error_count_, write_count_); |
| 113 #else | |
| 114 "AISW: number of detected audio glitches: %zu out of %zu", | |
| 115 #endif | |
| 116 write_error_count_, | |
| 117 write_count_); | |
| 118 MediaStreamManager::SendMessageToNativeLog(log_string); | 114 MediaStreamManager::SendMessageToNativeLog(log_string); |
| 119 DVLOG(1) << log_string; | 115 DVLOG(1) << log_string; |
| 120 } | 116 } |
| 121 | 117 |
| 122 void AudioInputSyncWriter::Write(const AudioBus* data, | 118 void AudioInputSyncWriter::Write(const AudioBus* data, |
| 123 double volume, | 119 double volume, |
| 124 bool key_pressed, | 120 bool key_pressed, |
| 125 uint32_t hardware_delay_bytes) { | 121 uint32_t hardware_delay_bytes) { |
| 126 ++write_count_; | 122 ++write_count_; |
| 127 CheckTimeSinceLastWrite(); | 123 CheckTimeSinceLastWrite(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 current_segment_id_ = 0; | 337 current_segment_id_ = 0; |
| 342 ++number_of_filled_segments_; | 338 ++number_of_filled_segments_; |
| 343 CHECK_LE(number_of_filled_segments_, | 339 CHECK_LE(number_of_filled_segments_, |
| 344 static_cast<int>(shared_memory_segment_count_)); | 340 static_cast<int>(shared_memory_segment_count_)); |
| 345 ++next_buffer_id_; | 341 ++next_buffer_id_; |
| 346 | 342 |
| 347 return true; | 343 return true; |
| 348 } | 344 } |
| 349 | 345 |
| 350 } // namespace content | 346 } // namespace content |
| OLD | NEW |