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

Side by Side Diff: media/audio/win/audio_low_latency_output_win.cc

Issue 281223002: Removed LOG_GETLASTERROR and LOG_ERRNO macros. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Wed 05/14/2014 11:20:03.21 Created 6 years, 7 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
« no previous file with comments | « device/hid/hid_service_win.cc ('k') | media/base/user_input_monitor_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "media/audio/win/audio_low_latency_output_win.h" 5 #include "media/audio/win/audio_low_latency_output_win.h"
6 6
7 #include <Functiondiscoverykeys_devpkey.h> 7 #include <Functiondiscoverykeys_devpkey.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (!render_thread_->HasBeenStarted()) { 245 if (!render_thread_->HasBeenStarted()) {
246 LOG(ERROR) << "Failed to start WASAPI render thread."; 246 LOG(ERROR) << "Failed to start WASAPI render thread.";
247 StopThread(); 247 StopThread();
248 callback->OnError(this); 248 callback->OnError(this);
249 return; 249 return;
250 } 250 }
251 251
252 // Start streaming data between the endpoint buffer and the audio engine. 252 // Start streaming data between the endpoint buffer and the audio engine.
253 HRESULT hr = audio_client_->Start(); 253 HRESULT hr = audio_client_->Start();
254 if (FAILED(hr)) { 254 if (FAILED(hr)) {
255 LOG_GETLASTERROR(ERROR) 255 PLOG(ERROR) << "Failed to start output streaming: " << std::hex << hr;
256 << "Failed to start output streaming: " << std::hex << hr;
257 StopThread(); 256 StopThread();
258 callback->OnError(this); 257 callback->OnError(this);
259 } 258 }
260 } 259 }
261 260
262 void WASAPIAudioOutputStream::Stop() { 261 void WASAPIAudioOutputStream::Stop() {
263 VLOG(1) << "WASAPIAudioOutputStream::Stop()"; 262 VLOG(1) << "WASAPIAudioOutputStream::Stop()";
264 DCHECK_EQ(GetCurrentThreadId(), creating_thread_id_); 263 DCHECK_EQ(GetCurrentThreadId(), creating_thread_id_);
265 if (!render_thread_) 264 if (!render_thread_)
266 return; 265 return;
267 266
268 // Stop output audio streaming. 267 // Stop output audio streaming.
269 HRESULT hr = audio_client_->Stop(); 268 HRESULT hr = audio_client_->Stop();
270 if (FAILED(hr)) { 269 if (FAILED(hr)) {
271 LOG_GETLASTERROR(ERROR) 270 PLOG(ERROR) << "Failed to stop output streaming: " << std::hex << hr;
272 << "Failed to stop output streaming: " << std::hex << hr;
273 source_->OnError(this); 271 source_->OnError(this);
274 } 272 }
275 273
276 // Make a local copy of |source_| since StopThread() will clear it. 274 // Make a local copy of |source_| since StopThread() will clear it.
277 AudioSourceCallback* callback = source_; 275 AudioSourceCallback* callback = source_;
278 StopThread(); 276 StopThread();
279 277
280 // Flush all pending data and reset the audio clock stream position to 0. 278 // Flush all pending data and reset the audio clock stream position to 0.
281 hr = audio_client_->Reset(); 279 hr = audio_client_->Reset();
282 if (FAILED(hr)) { 280 if (FAILED(hr)) {
283 LOG_GETLASTERROR(ERROR) 281 PLOG(ERROR) << "Failed to reset streaming: " << std::hex << hr;
284 << "Failed to reset streaming: " << std::hex << hr;
285 callback->OnError(this); 282 callback->OnError(this);
286 } 283 }
287 284
288 // Extra safety check to ensure that the buffers are cleared. 285 // Extra safety check to ensure that the buffers are cleared.
289 // If the buffers are not cleared correctly, the next call to Start() 286 // If the buffers are not cleared correctly, the next call to Start()
290 // would fail with AUDCLNT_E_BUFFER_ERROR at IAudioRenderClient::GetBuffer(). 287 // would fail with AUDCLNT_E_BUFFER_ERROR at IAudioRenderClient::GetBuffer().
291 // This check is is only needed for shared-mode streams. 288 // This check is is only needed for shared-mode streams.
292 if (share_mode_ == AUDCLNT_SHAREMODE_SHARED) { 289 if (share_mode_ == AUDCLNT_SHAREMODE_SHARED) {
293 UINT32 num_queued_frames = 0; 290 UINT32 num_queued_frames = 0;
294 audio_client_->GetCurrentPadding(&num_queued_frames); 291 audio_client_->GetCurrentPadding(&num_queued_frames);
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 608
612 // Ensure that we don't quit the main thread loop immediately next 609 // Ensure that we don't quit the main thread loop immediately next
613 // time Start() is called. 610 // time Start() is called.
614 ResetEvent(stop_render_event_.Get()); 611 ResetEvent(stop_render_event_.Get());
615 } 612 }
616 613
617 source_ = NULL; 614 source_ = NULL;
618 } 615 }
619 616
620 } // namespace media 617 } // namespace media
OLDNEW
« no previous file with comments | « device/hid/hid_service_win.cc ('k') | media/base/user_input_monitor_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698