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

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

Issue 467833002: Remove AudioBuffersState class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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
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 "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 num_written_frames_ + packet_size_frames_; 491 num_written_frames_ + packet_size_frames_;
492 492
493 // Derive the actual delay value which will be fed to the 493 // Derive the actual delay value which will be fed to the
494 // render client using the OnMoreData() callback. 494 // render client using the OnMoreData() callback.
495 audio_delay_bytes = (pos_last_sample_written_frames - 495 audio_delay_bytes = (pos_last_sample_written_frames -
496 pos_sample_playing_frames) * format_.Format.nBlockAlign; 496 pos_sample_playing_frames) * format_.Format.nBlockAlign;
497 } 497 }
498 498
499 // Read a data packet from the registered client source and 499 // Read a data packet from the registered client source and
500 // deliver a delay estimate in the same callback to the client. 500 // deliver a delay estimate in the same callback to the client.
501 // A time stamp is also stored in the AudioBuffersState. This
502 // time stamp can be used at the client side to compensate for
503 // the delay between the usage of the delay value and the time
504 // of generation.
505 501
506 int frames_filled = source_->OnMoreData( 502 int frames_filled = source_->OnMoreData(
507 audio_bus_.get(), AudioBuffersState(0, audio_delay_bytes)); 503 audio_bus_.get(), audio_delay_bytes);
508 uint32 num_filled_bytes = frames_filled * format_.Format.nBlockAlign; 504 uint32 num_filled_bytes = frames_filled * format_.Format.nBlockAlign;
509 DCHECK_LE(num_filled_bytes, packet_size_bytes_); 505 DCHECK_LE(num_filled_bytes, packet_size_bytes_);
510 506
511 // Note: If this ever changes to output raw float the data must be 507 // Note: If this ever changes to output raw float the data must be
512 // clipped and sanitized since it may come from an untrusted 508 // clipped and sanitized since it may come from an untrusted
513 // source such as NaCl. 509 // source such as NaCl.
514 const int bytes_per_sample = format_.Format.wBitsPerSample >> 3; 510 const int bytes_per_sample = format_.Format.wBitsPerSample >> 3;
515 audio_bus_->Scale(volume_); 511 audio_bus_->Scale(volume_);
516 audio_bus_->ToInterleaved( 512 audio_bus_->ToInterleaved(
517 frames_filled, bytes_per_sample, audio_data); 513 frames_filled, bytes_per_sample, audio_data);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 616
621 // Ensure that we don't quit the main thread loop immediately next 617 // Ensure that we don't quit the main thread loop immediately next
622 // time Start() is called. 618 // time Start() is called.
623 ResetEvent(stop_render_event_.Get()); 619 ResetEvent(stop_render_event_.Get());
624 } 620 }
625 621
626 source_ = NULL; 622 source_ = NULL;
627 } 623 }
628 624
629 } // namespace media 625 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/virtual_audio_output_stream.cc ('k') | media/audio/win/audio_low_latency_output_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698