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

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

Issue 2720433002: Notify WASAPIAudioOutputStream users of rendering errors. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | 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 <climits> 9 #include <climits>
10 10
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 // |audio_samples_render_event_| has been set. 409 // |audio_samples_render_event_| has been set.
410 error = !RenderAudioFromSource(device_frequency); 410 error = !RenderAudioFromSource(device_frequency);
411 break; 411 break;
412 default: 412 default:
413 error = true; 413 error = true;
414 break; 414 break;
415 } 415 }
416 } 416 }
417 417
418 if (playing && error) { 418 if (playing && error) {
419 LOG(ERROR) << "WASAPI rendering failed.";
420
419 // Stop audio rendering since something has gone wrong in our main thread 421 // Stop audio rendering since something has gone wrong in our main thread
420 // loop. Note that, we are still in a "started" state, hence a Stop() call 422 // loop. Note that, we are still in a "started" state, hence a Stop() call
421 // is required to join the thread properly. 423 // is required to join the thread properly.
422 audio_client_->Stop(); 424 audio_client_->Stop();
423 PLOG(ERROR) << "WASAPI rendering failed."; 425
426 // Notify clients that something has gone wrong and that this stream should
427 // be destroyed instead of reused in the future.
428 source_->OnError(this);
424 } 429 }
425 430
426 // Disable MMCSS. 431 // Disable MMCSS.
427 if (mm_task && !avrt::AvRevertMmThreadCharacteristics(mm_task)) { 432 if (mm_task && !avrt::AvRevertMmThreadCharacteristics(mm_task)) {
428 PLOG(WARNING) << "Failed to disable MMCSS"; 433 PLOG(WARNING) << "Failed to disable MMCSS";
429 } 434 }
430 } 435 }
431 436
432 bool WASAPIAudioOutputStream::RenderAudioFromSource(UINT64 device_frequency) { 437 bool WASAPIAudioOutputStream::RenderAudioFromSource(UINT64 device_frequency) {
433 TRACE_EVENT0("audio", "RenderAudioFromSource"); 438 TRACE_EVENT0("audio", "RenderAudioFromSource");
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 649
645 // Ensure that we don't quit the main thread loop immediately next 650 // Ensure that we don't quit the main thread loop immediately next
646 // time Start() is called. 651 // time Start() is called.
647 ResetEvent(stop_render_event_.Get()); 652 ResetEvent(stop_render_event_.Get());
648 } 653 }
649 654
650 source_ = NULL; 655 source_ = NULL;
651 } 656 }
652 657
653 } // namespace media 658 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698