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

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

Issue 13726011: Add vector_math::FMUL. Replace audio_util::AdjustVolume. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix volume == 1 case. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/win/audio_low_latency_output_win.cc ('k') | media/audio/win/waveout_output_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_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"
11 #include "base/win/scoped_com_initializer.h" 11 #include "base/win/scoped_com_initializer.h"
12 #include "media/audio/audio_util.h"
13 #include "media/audio/win/audio_manager_win.h" 12 #include "media/audio/win/audio_manager_win.h"
14 #include "media/audio/win/avrt_wrapper_win.h" 13 #include "media/audio/win/avrt_wrapper_win.h"
15 #include "media/audio/win/core_audio_util_win.h" 14 #include "media/audio/win/core_audio_util_win.h"
16 15
17 using base::win::ScopedComPtr; 16 using base::win::ScopedComPtr;
18 using base::win::ScopedCOMInitializer; 17 using base::win::ScopedCOMInitializer;
19 using base::win::ScopedCoMem; 18 using base::win::ScopedCoMem;
20 19
21 // Time in milliseconds between two successive delay measurements. 20 // Time in milliseconds between two successive delay measurements.
22 // We save resources by not updating the delay estimates for each capture 21 // We save resources by not updating the delay estimates for each capture
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 uint8* audio_data = NULL; 521 uint8* audio_data = NULL;
523 hr = audio_render_client_->GetBuffer(packet_size_frames_, 522 hr = audio_render_client_->GetBuffer(packet_size_frames_,
524 &audio_data); 523 &audio_data);
525 if (FAILED(hr)) { 524 if (FAILED(hr)) {
526 DLOG(ERROR) << "Failed to access render buffer"; 525 DLOG(ERROR) << "Failed to access render buffer";
527 continue; 526 continue;
528 } 527 }
529 528
530 // Convert the audio bus content to interleaved integer data using 529 // Convert the audio bus content to interleaved integer data using
531 // |audio_data| as destination. 530 // |audio_data| as destination.
531 render_bus_->Scale(volume_);
532 render_bus_->ToInterleaved( 532 render_bus_->ToInterleaved(
533 packet_size_frames_, bytes_per_sample, audio_data); 533 packet_size_frames_, bytes_per_sample, audio_data);
534 534
535 // Perform in-place, software-volume adjustments.
536 media::AdjustVolume(audio_data,
537 frames_filled * format_.Format.nBlockAlign,
538 render_bus_->channels(),
539 bytes_per_sample,
540 volume_);
541
542 // Release the buffer space acquired in the GetBuffer() call. 535 // Release the buffer space acquired in the GetBuffer() call.
543 audio_render_client_->ReleaseBuffer(packet_size_frames_, 0); 536 audio_render_client_->ReleaseBuffer(packet_size_frames_, 0);
544 DLOG_IF(ERROR, FAILED(hr)) << "Failed to release render buffer"; 537 DLOG_IF(ERROR, FAILED(hr)) << "Failed to release render buffer";
545 } 538 }
546 break; 539 break;
547 default: 540 default:
548 error = true; 541 error = true;
549 break; 542 break;
550 } 543 }
551 } 544 }
(...skipping 24 matching lines...) Expand all
576 void WASAPIUnifiedStream::StopAndJoinThread(HRESULT err) { 569 void WASAPIUnifiedStream::StopAndJoinThread(HRESULT err) {
577 CHECK(GetCurrentThreadId() == creating_thread_id_); 570 CHECK(GetCurrentThreadId() == creating_thread_id_);
578 DCHECK(audio_io_thread_.get()); 571 DCHECK(audio_io_thread_.get());
579 SetEvent(stop_streaming_event_.Get()); 572 SetEvent(stop_streaming_event_.Get());
580 audio_io_thread_->Join(); 573 audio_io_thread_->Join();
581 audio_io_thread_.reset(); 574 audio_io_thread_.reset();
582 HandleError(err); 575 HandleError(err);
583 } 576 }
584 577
585 } // namespace media 578 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/win/audio_low_latency_output_win.cc ('k') | media/audio/win/waveout_output_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698