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

Side by Side Diff: content/browser/renderer_host/media/audio_sync_reader.cc

Issue 2822123002: Avoid log spam in AudioSyncReader. (Closed)
Patch Set: Created 3 years, 8 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 #include "content/browser/renderer_host/media/audio_sync_reader.h" 5 #include "content/browser/renderer_host/media/audio_sync_reader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 namespace content { 46 namespace content {
47 47
48 AudioSyncReader::AudioSyncReader( 48 AudioSyncReader::AudioSyncReader(
49 const media::AudioParameters& params, 49 const media::AudioParameters& params,
50 std::unique_ptr<base::SharedMemory> shared_memory, 50 std::unique_ptr<base::SharedMemory> shared_memory,
51 std::unique_ptr<base::CancelableSyncSocket> socket, 51 std::unique_ptr<base::CancelableSyncSocket> socket,
52 std::unique_ptr<base::CancelableSyncSocket> foreign_socket) 52 std::unique_ptr<base::CancelableSyncSocket> foreign_socket)
53 : shared_memory_(std::move(shared_memory)), 53 : shared_memory_(std::move(shared_memory)),
54 mute_audio_(base::CommandLine::ForCurrentProcess()->HasSwitch( 54 mute_audio_(base::CommandLine::ForCurrentProcess()->HasSwitch(
55 switches::kMuteAudio)), 55 switches::kMuteAudio)),
56 had_socket_error_(false),
56 socket_(std::move(socket)), 57 socket_(std::move(socket)),
57 foreign_socket_(std::move(foreign_socket)), 58 foreign_socket_(std::move(foreign_socket)),
58 packet_size_(shared_memory_->requested_size()), 59 packet_size_(shared_memory_->requested_size()),
59 renderer_callback_count_(0), 60 renderer_callback_count_(0),
60 renderer_missed_callback_count_(0), 61 renderer_missed_callback_count_(0),
61 trailing_renderer_missed_callback_count_(0), 62 trailing_renderer_missed_callback_count_(0),
62 #if defined(OS_MACOSX) || defined(OS_CHROMEOS) 63 #if defined(OS_MACOSX) || defined(OS_CHROMEOS)
63 maximum_wait_time_(params.GetBufferDuration() / 2), 64 maximum_wait_time_(params.GetBufferDuration() / 2),
64 #else 65 #else
65 // TODO(dalecurtis): Investigate if we can reduce this on all platforms. 66 // TODO(dalecurtis): Investigate if we can reduce this on all platforms.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 169
169 uint32_t control_signal = 0; 170 uint32_t control_signal = 0;
170 if (delay.is_max()) { 171 if (delay.is_max()) {
171 // std::numeric_limits<uint32_t>::max() is a special signal which is 172 // std::numeric_limits<uint32_t>::max() is a special signal which is
172 // returned after the browser stops the output device in response to a 173 // returned after the browser stops the output device in response to a
173 // renderer side request. 174 // renderer side request.
174 control_signal = std::numeric_limits<uint32_t>::max(); 175 control_signal = std::numeric_limits<uint32_t>::max();
175 } 176 }
176 177
177 size_t sent_bytes = socket_->Send(&control_signal, sizeof(control_signal)); 178 size_t sent_bytes = socket_->Send(&control_signal, sizeof(control_signal));
178 if (sent_bytes != sizeof(control_signal)) { 179 if (sent_bytes != sizeof(control_signal) && !had_socket_error_) {
180 had_socket_error_ = true;
tommi (sloooow) - chröme 2017/04/18 09:39:28 same here
Max Morin 2017/04/19 11:51:01 Done.
179 const std::string error_message = "ASR: No room in socket buffer."; 181 const std::string error_message = "ASR: No room in socket buffer.";
180 LOG(WARNING) << error_message; 182 PLOG(WARNING) << error_message;
181 MediaStreamManager::SendMessageToNativeLog(error_message); 183 MediaStreamManager::SendMessageToNativeLog(error_message);
182 TRACE_EVENT_INSTANT0("audio", 184 TRACE_EVENT_INSTANT0("audio",
183 "AudioSyncReader: No room in socket buffer", 185 "AudioSyncReader: No room in socket buffer",
184 TRACE_EVENT_SCOPE_THREAD); 186 TRACE_EVENT_SCOPE_THREAD);
185 } 187 }
186 ++buffer_index_; 188 ++buffer_index_;
187 } 189 }
188 190
189 void AudioSyncReader::Read(AudioBus* dest) { 191 void AudioSyncReader::Read(AudioBus* dest) {
190 ++renderer_callback_count_; 192 ++renderer_callback_count_;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 base::TimeDelta::FromMilliseconds(1), 263 base::TimeDelta::FromMilliseconds(1),
262 base::TimeDelta::FromMilliseconds(1000), 264 base::TimeDelta::FromMilliseconds(1000),
263 50); 265 50);
264 return false; 266 return false;
265 } 267 }
266 268
267 return true; 269 return true;
268 } 270 }
269 271
270 } // namespace content 272 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698