Chromium Code Reviews| 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 "media/audio/win/audio_unified_win.h" | 5 #include "media/audio/win/audio_unified_win.h" |
| 6 | 6 |
| 7 #include <Functiondiscoverykeys_devpkey.h> | 7 #include <Functiondiscoverykeys_devpkey.h> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 } | 239 } |
| 240 | 240 |
| 241 // Start input streaming data between the endpoint buffer and the audio | 241 // Start input streaming data between the endpoint buffer and the audio |
| 242 // engine. | 242 // engine. |
| 243 HRESULT hr = audio_input_client_->Start(); | 243 HRESULT hr = audio_input_client_->Start(); |
| 244 if (FAILED(hr)) { | 244 if (FAILED(hr)) { |
| 245 StopAndJoinThread(hr); | 245 StopAndJoinThread(hr); |
| 246 return; | 246 return; |
| 247 } | 247 } |
| 248 | 248 |
| 249 // Reset the counter for number of rendered frames taking into account the | 249 // Ensure that the endpoint buffer is prepared with silence. |
| 250 // fact that we always initialize the render side with silence. | 250 if (share_mode_ == AUDCLNT_SHAREMODE_SHARED) { |
| 251 UINT32 num_queued_frames = 0; | 251 if (!CoreAudioUtil::FillRenderEndpointBufferWithSilence( |
| 252 audio_output_client_->GetCurrentPadding(&num_queued_frames); | 252 audio_output_client_, audio_render_client_)) { |
|
tommi (sloooow) - chröme
2013/01/31 16:18:24
same here
henrika (OOO until Aug 14)
2013/02/01 10:55:56
Done.
| |
| 253 DCHECK_EQ(num_queued_frames, endpoint_render_buffer_size_frames_); | 253 DLOG(WARNING) << "Failed to prepare endpoint buffers with silence."; |
| 254 num_written_frames_ = num_queued_frames; | 254 return; |
| 255 } | |
| 256 } | |
| 257 num_written_frames_ = endpoint_render_buffer_size_frames_; | |
| 255 | 258 |
| 256 // Start output streaming data between the endpoint buffer and the audio | 259 // Start output streaming data between the endpoint buffer and the audio |
| 257 // engine. | 260 // engine. |
| 258 hr = audio_output_client_->Start(); | 261 hr = audio_output_client_->Start(); |
| 259 if (FAILED(hr)) { | 262 if (FAILED(hr)) { |
| 260 StopAndJoinThread(hr); | 263 StopAndJoinThread(hr); |
| 261 return; | 264 return; |
| 262 } | 265 } |
| 263 } | 266 } |
| 264 | 267 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 560 void WASAPIUnifiedStream::StopAndJoinThread(HRESULT err) { | 563 void WASAPIUnifiedStream::StopAndJoinThread(HRESULT err) { |
| 561 CHECK(GetCurrentThreadId() == creating_thread_id_); | 564 CHECK(GetCurrentThreadId() == creating_thread_id_); |
| 562 DCHECK(audio_io_thread_.get()); | 565 DCHECK(audio_io_thread_.get()); |
| 563 SetEvent(stop_streaming_event_.Get()); | 566 SetEvent(stop_streaming_event_.Get()); |
| 564 audio_io_thread_->Join(); | 567 audio_io_thread_->Join(); |
| 565 audio_io_thread_.reset(); | 568 audio_io_thread_.reset(); |
| 566 HandleError(err); | 569 HandleError(err); |
| 567 } | 570 } |
| 568 | 571 |
| 569 } // namespace media | 572 } // namespace media |
| OLD | NEW |