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

Side by Side Diff: trunk/src/media/audio/win/waveout_output_win.cc

Issue 487543002: Revert 290359 "Remove AudioBuffersState class." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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
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/waveout_output_win.h" 5 #include "media/audio/win/waveout_output_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <mmsystem.h> 8 #include <mmsystem.h>
9 #pragma comment(lib, "winmm.lib") 9 #pragma comment(lib, "winmm.lib")
10 10
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 if (callback_) 318 if (callback_)
319 callback_->OnError(this); 319 callback_->OnError(this);
320 } 320 }
321 321
322 void PCMWaveOutAudioOutputStream::QueueNextPacket(WAVEHDR *buffer) { 322 void PCMWaveOutAudioOutputStream::QueueNextPacket(WAVEHDR *buffer) {
323 DCHECK_EQ(channels_, format_.Format.nChannels); 323 DCHECK_EQ(channels_, format_.Format.nChannels);
324 // Call the source which will fill our buffer with pleasant sounds and 324 // Call the source which will fill our buffer with pleasant sounds and
325 // return to us how many bytes were used. 325 // return to us how many bytes were used.
326 // TODO(fbarchard): Handle used 0 by queueing more. 326 // TODO(fbarchard): Handle used 0 by queueing more.
327 327
328 // TODO(sergeyu): Specify correct hardware delay for |total_delay_bytes|. 328 // TODO(sergeyu): Specify correct hardware delay for AudioBuffersState.
329 int total_delay_bytes = pending_bytes_;
330 int frames_filled = callback_->OnMoreData( 329 int frames_filled = callback_->OnMoreData(
331 audio_bus_.get(), total_delay_bytes); 330 audio_bus_.get(), AudioBuffersState(pending_bytes_, 0));
332 uint32 used = frames_filled * audio_bus_->channels() * 331 uint32 used = frames_filled * audio_bus_->channels() *
333 format_.Format.wBitsPerSample / 8; 332 format_.Format.wBitsPerSample / 8;
334 333
335 if (used <= buffer_size_) { 334 if (used <= buffer_size_) {
336 // Note: If this ever changes to output raw float the data must be clipped 335 // Note: If this ever changes to output raw float the data must be clipped
337 // and sanitized since it may come from an untrusted source such as NaCl. 336 // and sanitized since it may come from an untrusted source such as NaCl.
338 audio_bus_->Scale(volume_); 337 audio_bus_->Scale(volume_);
339 audio_bus_->ToInterleaved( 338 audio_bus_->ToInterleaved(
340 frames_filled, format_.Format.wBitsPerSample / 8, buffer->lpData); 339 frames_filled, format_.Format.wBitsPerSample / 8, buffer->lpData);
341 340
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 buffer, 387 buffer,
389 sizeof(WAVEHDR)); 388 sizeof(WAVEHDR));
390 if (result != MMSYSERR_NOERROR) 389 if (result != MMSYSERR_NOERROR)
391 stream->HandleError(result); 390 stream->HandleError(result);
392 stream->pending_bytes_ += buffer->dwBufferLength; 391 stream->pending_bytes_ += buffer->dwBufferLength;
393 } 392 }
394 } 393 }
395 } 394 }
396 395
397 } // namespace media 396 } // namespace media
OLDNEW
« no previous file with comments | « trunk/src/media/audio/win/audio_output_win_unittest.cc ('k') | trunk/src/media/cast/test/receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698