int AudioStreamSanitizer::GetFrameCount() const {
int frame_count = 0;
- for (BufferQueue::const_iterator it = output_buffers_.begin();
- it != output_buffers_.end(); ++it) {
- frame_count += (*it)->frame_count();
- }
+ for (const auto& buffer : output_buffers_)
+ frame_count += buffer->frame_count();
return frame_count;
}
// called if there is not enough data to crossfade.
// TODO(dalecurtis): Convert to DCHECK() once http://crbug.com/356073 fixed.
CHECK(output_bus);
- CHECK(*crossfade_buffer);
+ CHECK(crossfade_buffer->get());
// All necessary buffers have been processed, it's safe to reset.
pre_splice_sanitizer_->Reset();
void AudioSplicer::CrossfadePostSplice(
scoped_ptr<AudioBus> pre_splice_bus,
- scoped_refptr<AudioBuffer> crossfade_buffer) {
+ const scoped_refptr<AudioBuffer>& crossfade_buffer) {
// Use the calculated timestamp and duration to ensure there's no extra gaps
// or overlaps to process when adding the buffer to |output_sanitizer_|.
const AudioTimestampHelper& output_ts_helper =
// If only part of the buffer was consumed, save it for after we've added
// the crossfade buffer
if (frames_to_read < postroll->frame_count()) {
- DCHECK(!remainder);
+ DCHECK(!remainder.get());
remainder.swap(postroll);
frames_to_trim = frames_to_read;
}
CHECK(output_sanitizer_->AddInput(crossfade_buffer));
DCHECK_EQ(crossfade_buffer->frame_count(), output_bus->frames());
- if (remainder) {
+ if (remainder.get()) {
// Trim off consumed frames.
AccurateTrimStart(frames_to_trim, remainder, output_ts_helper);
CHECK(output_sanitizer_->AddInput(remainder));