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

Side by Side Diff: media/base/audio_block_fifo.cc

Issue 1138163002: Passing scoped_ptr into ScopedVector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « media/audio/audio_input_device.cc ('k') | media/cast/sender/external_video_encoder.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "media/base/audio_block_fifo.h" 7 #include "media/base/audio_block_fifo.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 void AudioBlockFifo::IncreaseCapacity(int blocks) { 88 void AudioBlockFifo::IncreaseCapacity(int blocks) {
89 DCHECK_GT(blocks, 0); 89 DCHECK_GT(blocks, 0);
90 90
91 // Create |blocks| of audio buses and insert them to the containers. 91 // Create |blocks| of audio buses and insert them to the containers.
92 audio_blocks_.reserve(audio_blocks_.size() + blocks); 92 audio_blocks_.reserve(audio_blocks_.size() + blocks);
93 93
94 const int original_size = audio_blocks_.size(); 94 const int original_size = audio_blocks_.size();
95 for (int i = 0; i < blocks; ++i) { 95 for (int i = 0; i < blocks; ++i) {
96 audio_blocks_.push_back( 96 audio_blocks_.push_back(
97 AudioBus::Create(channels_, block_frames_).release()); 97 AudioBus::Create(channels_, block_frames_).Pass());
xhwang 2015/05/12 16:13:06 .Pass() not needed?
anujsharma 2015/05/13 03:01:07 Ok, I will remove it in next patchset.
98 } 98 }
99 99
100 if (!original_size) 100 if (!original_size)
101 return; 101 return;
102 102
103 std::rotate(audio_blocks_.begin() + read_block_, 103 std::rotate(audio_blocks_.begin() + read_block_,
104 audio_blocks_.begin() + original_size, 104 audio_blocks_.begin() + original_size,
105 audio_blocks_.end()); 105 audio_blocks_.end());
106 106
107 // Update the write pointer if it is on top of the new inserted blocks. 107 // Update the write pointer if it is on top of the new inserted blocks.
108 if (write_block_ >= read_block_) 108 if (write_block_ >= read_block_)
109 write_block_ += blocks; 109 write_block_ += blocks;
110 110
111 // Update the read pointers correspondingly. 111 // Update the read pointers correspondingly.
112 read_block_ += blocks; 112 read_block_ += blocks;
113 113
114 DCHECK_LT(read_block_, static_cast<int>(audio_blocks_.size())); 114 DCHECK_LT(read_block_, static_cast<int>(audio_blocks_.size()));
115 DCHECK_LT(write_block_, static_cast<int>(audio_blocks_.size())); 115 DCHECK_LT(write_block_, static_cast<int>(audio_blocks_.size()));
116 } 116 }
117 117
118 } // namespace media 118 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_input_device.cc ('k') | media/cast/sender/external_video_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698