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

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

Issue 2722053002: Merge M57: "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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 // |audio_samples_render_event_| has been set. 429 // |audio_samples_render_event_| has been set.
430 error = !RenderAudioFromSource(device_frequency); 430 error = !RenderAudioFromSource(device_frequency);
431 break; 431 break;
432 default: 432 default:
433 error = true; 433 error = true;
434 break; 434 break;
435 } 435 }
436 } 436 }
437 437
438 if (playing && error) { 438 if (playing && error) {
439 LOG(ERROR) << "WASAPI rendering failed.";
440
439 // Stop audio rendering since something has gone wrong in our main thread 441 // Stop audio rendering since something has gone wrong in our main thread
440 // loop. Note that, we are still in a "started" state, hence a Stop() call 442 // loop. Note that, we are still in a "started" state, hence a Stop() call
441 // is required to join the thread properly. 443 // is required to join the thread properly.
442 audio_client_->Stop(); 444 audio_client_->Stop();
443 PLOG(ERROR) << "WASAPI rendering failed."; 445
446 // Notify clients that something has gone wrong and that this stream should
447 // be destroyed instead of reused in the future.
448 source_->OnError(this);
444 } 449 }
445 450
446 // Disable MMCSS. 451 // Disable MMCSS.
447 if (mm_task && !avrt::AvRevertMmThreadCharacteristics(mm_task)) { 452 if (mm_task && !avrt::AvRevertMmThreadCharacteristics(mm_task)) {
448 PLOG(WARNING) << "Failed to disable MMCSS"; 453 PLOG(WARNING) << "Failed to disable MMCSS";
449 } 454 }
450 } 455 }
451 456
452 bool WASAPIAudioOutputStream::RenderAudioFromSource(UINT64 device_frequency) { 457 bool WASAPIAudioOutputStream::RenderAudioFromSource(UINT64 device_frequency) {
453 TRACE_EVENT0("audio", "RenderAudioFromSource"); 458 TRACE_EVENT0("audio", "RenderAudioFromSource");
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 669
665 // Ensure that we don't quit the main thread loop immediately next 670 // Ensure that we don't quit the main thread loop immediately next
666 // time Start() is called. 671 // time Start() is called.
667 ResetEvent(stop_render_event_.Get()); 672 ResetEvent(stop_render_event_.Get());
668 } 673 }
669 674
670 source_ = NULL; 675 source_ = NULL;
671 } 676 }
672 677
673 } // namespace media 678 } // 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