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

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

Issue 1906423005: Replace scoped_ptr with std::unique_ptr in //media/base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-media-base: . Created 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/base/audio_buffer_queue.h"
6
5 #include <stdint.h> 7 #include <stdint.h>
6 8
7 #include <limits> 9 #include <limits>
10 #include <memory>
8 11
9 #include "base/logging.h" 12 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/time/time.h" 13 #include "base/time/time.h"
12 #include "media/base/audio_buffer.h" 14 #include "media/base/audio_buffer.h"
13 #include "media/base/audio_buffer_queue.h"
14 #include "media/base/audio_bus.h" 15 #include "media/base/audio_bus.h"
15 #include "media/base/test_helpers.h" 16 #include "media/base/test_helpers.h"
16 #include "media/base/timestamp_constants.h" 17 #include "media/base/timestamp_constants.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 namespace media { 20 namespace media {
20 21
21 const int kSampleRate = 44100; 22 const int kSampleRate = 44100;
22 23
23 static void VerifyBus(AudioBus* bus, 24 static void VerifyBus(AudioBus* bus,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 EXPECT_EQ(32, buffer.frames()); 83 EXPECT_EQ(32, buffer.frames());
83 buffer.Append( 84 buffer.Append(
84 MakeTestBuffer<uint8_t>(kSampleFormatU8, channel_layout, 10, 1, 8)); 85 MakeTestBuffer<uint8_t>(kSampleFormatU8, channel_layout, 10, 1, 8));
85 EXPECT_EQ(40, buffer.frames()); 86 EXPECT_EQ(40, buffer.frames());
86 } 87 }
87 88
88 TEST(AudioBufferQueueTest, IteratorCheck) { 89 TEST(AudioBufferQueueTest, IteratorCheck) {
89 const ChannelLayout channel_layout = CHANNEL_LAYOUT_MONO; 90 const ChannelLayout channel_layout = CHANNEL_LAYOUT_MONO;
90 const int channels = ChannelLayoutToChannelCount(channel_layout); 91 const int channels = ChannelLayoutToChannelCount(channel_layout);
91 AudioBufferQueue buffer; 92 AudioBufferQueue buffer;
92 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, 100); 93 std::unique_ptr<AudioBus> bus = AudioBus::Create(channels, 100);
93 94
94 // Append 40 frames in 5 buffers. Intersperse ReadFrames() to make the 95 // Append 40 frames in 5 buffers. Intersperse ReadFrames() to make the
95 // iterator is pointing to the correct position. 96 // iterator is pointing to the correct position.
96 buffer.Append(MakeTestBuffer<float>( 97 buffer.Append(MakeTestBuffer<float>(
97 kSampleFormatF32, channel_layout, 10.0f, 1.0f, 8)); 98 kSampleFormatF32, channel_layout, 10.0f, 1.0f, 8));
98 EXPECT_EQ(8, buffer.frames()); 99 EXPECT_EQ(8, buffer.frames());
99 100
100 EXPECT_EQ(4, buffer.ReadFrames(4, 0, bus.get())); 101 EXPECT_EQ(4, buffer.ReadFrames(4, 0, bus.get()));
101 EXPECT_EQ(4, buffer.frames()); 102 EXPECT_EQ(4, buffer.frames());
102 VerifyBus(bus.get(), 0, 4, bus->frames(), 10, 1); 103 VerifyBus(bus.get(), 0, 4, bus->frames(), 10, 1);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // Add 76 frames of data. 160 // Add 76 frames of data.
160 buffer.Append( 161 buffer.Append(
161 MakeTestBuffer<float>(kSampleFormatF32, channel_layout, 1.0f, 1.0f, 6)); 162 MakeTestBuffer<float>(kSampleFormatF32, channel_layout, 1.0f, 1.0f, 6));
162 buffer.Append( 163 buffer.Append(
163 MakeTestBuffer<float>(kSampleFormatF32, channel_layout, 13.0f, 1.0f, 10)); 164 MakeTestBuffer<float>(kSampleFormatF32, channel_layout, 13.0f, 1.0f, 10));
164 buffer.Append( 165 buffer.Append(
165 MakeTestBuffer<float>(kSampleFormatF32, channel_layout, 33.0f, 1.0f, 60)); 166 MakeTestBuffer<float>(kSampleFormatF32, channel_layout, 33.0f, 1.0f, 60));
166 EXPECT_EQ(76, buffer.frames()); 167 EXPECT_EQ(76, buffer.frames());
167 168
168 // Read 3 frames from the buffer. 169 // Read 3 frames from the buffer.
169 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, 100); 170 std::unique_ptr<AudioBus> bus = AudioBus::Create(channels, 100);
170 EXPECT_EQ(3, buffer.ReadFrames(3, 0, bus.get())); 171 EXPECT_EQ(3, buffer.ReadFrames(3, 0, bus.get()));
171 EXPECT_EQ(73, buffer.frames()); 172 EXPECT_EQ(73, buffer.frames());
172 VerifyBus(bus.get(), 0, 3, 6, 1, 1); 173 VerifyBus(bus.get(), 0, 3, 6, 1, 1);
173 174
174 // Now read 5 frames, which will span buffers. Append the data into AudioBus. 175 // Now read 5 frames, which will span buffers. Append the data into AudioBus.
175 EXPECT_EQ(5, buffer.ReadFrames(5, 3, bus.get())); 176 EXPECT_EQ(5, buffer.ReadFrames(5, 3, bus.get()));
176 EXPECT_EQ(68, buffer.frames()); 177 EXPECT_EQ(68, buffer.frames());
177 VerifyBus(bus.get(), 0, 6, 6, 1, 1); 178 VerifyBus(bus.get(), 0, 6, 6, 1, 1);
178 VerifyBus(bus.get(), 6, 2, 10, 13, 1); 179 VerifyBus(bus.get(), 6, 2, 10, 13, 1);
179 180
(...skipping 10 matching lines...) Expand all
190 const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0; 191 const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0;
191 const int channels = ChannelLayoutToChannelCount(channel_layout); 192 const int channels = ChannelLayoutToChannelCount(channel_layout);
192 const int frames = 4; 193 const int frames = 4;
193 AudioBufferQueue buffer; 194 AudioBufferQueue buffer;
194 195
195 // Add 4 frames of data. 196 // Add 4 frames of data.
196 buffer.Append( 197 buffer.Append(
197 MakeTestBuffer<uint8_t>(kSampleFormatU8, channel_layout, 128, 1, frames)); 198 MakeTestBuffer<uint8_t>(kSampleFormatU8, channel_layout, 128, 1, frames));
198 199
199 // Read all 4 frames from the buffer. 200 // Read all 4 frames from the buffer.
200 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, frames); 201 std::unique_ptr<AudioBus> bus = AudioBus::Create(channels, frames);
201 EXPECT_EQ(frames, buffer.ReadFrames(frames, 0, bus.get())); 202 EXPECT_EQ(frames, buffer.ReadFrames(frames, 0, bus.get()));
202 EXPECT_EQ(0, buffer.frames()); 203 EXPECT_EQ(0, buffer.frames());
203 VerifyBus(bus.get(), 0, frames, bus->frames(), 0, 1.0f / 127.0f); 204 VerifyBus(bus.get(), 0, frames, bus->frames(), 0, 1.0f / 127.0f);
204 } 205 }
205 206
206 TEST(AudioBufferQueueTest, ReadS16) { 207 TEST(AudioBufferQueueTest, ReadS16) {
207 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; 208 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
208 const int channels = ChannelLayoutToChannelCount(channel_layout); 209 const int channels = ChannelLayoutToChannelCount(channel_layout);
209 AudioBufferQueue buffer; 210 AudioBufferQueue buffer;
210 211
211 // Add 24 frames of data. 212 // Add 24 frames of data.
212 buffer.Append( 213 buffer.Append(
213 MakeTestBuffer<int16_t>(kSampleFormatS16, channel_layout, 1, 1, 4)); 214 MakeTestBuffer<int16_t>(kSampleFormatS16, channel_layout, 1, 1, 4));
214 buffer.Append( 215 buffer.Append(
215 MakeTestBuffer<int16_t>(kSampleFormatS16, channel_layout, 9, 1, 20)); 216 MakeTestBuffer<int16_t>(kSampleFormatS16, channel_layout, 9, 1, 20));
216 EXPECT_EQ(24, buffer.frames()); 217 EXPECT_EQ(24, buffer.frames());
217 218
218 // Read 6 frames from the buffer. 219 // Read 6 frames from the buffer.
219 const int frames = 6; 220 const int frames = 6;
220 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, buffer.frames()); 221 std::unique_ptr<AudioBus> bus = AudioBus::Create(channels, buffer.frames());
221 EXPECT_EQ(frames, buffer.ReadFrames(frames, 0, bus.get())); 222 EXPECT_EQ(frames, buffer.ReadFrames(frames, 0, bus.get()));
222 EXPECT_EQ(18, buffer.frames()); 223 EXPECT_EQ(18, buffer.frames());
223 VerifyBus(bus.get(), 0, 4, 4, 1.0f / std::numeric_limits<int16_t>::max(), 224 VerifyBus(bus.get(), 0, 4, 4, 1.0f / std::numeric_limits<int16_t>::max(),
224 1.0f / std::numeric_limits<int16_t>::max()); 225 1.0f / std::numeric_limits<int16_t>::max());
225 VerifyBus(bus.get(), 4, 2, 20, 9.0f / std::numeric_limits<int16_t>::max(), 226 VerifyBus(bus.get(), 4, 2, 20, 9.0f / std::numeric_limits<int16_t>::max(),
226 1.0f / std::numeric_limits<int16_t>::max()); 227 1.0f / std::numeric_limits<int16_t>::max());
227 } 228 }
228 229
229 TEST(AudioBufferQueueTest, ReadS32) { 230 TEST(AudioBufferQueueTest, ReadS32) {
230 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; 231 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
231 const int channels = ChannelLayoutToChannelCount(channel_layout); 232 const int channels = ChannelLayoutToChannelCount(channel_layout);
232 AudioBufferQueue buffer; 233 AudioBufferQueue buffer;
233 234
234 // Add 24 frames of data. 235 // Add 24 frames of data.
235 buffer.Append( 236 buffer.Append(
236 MakeTestBuffer<int32_t>(kSampleFormatS32, channel_layout, 1, 1, 4)); 237 MakeTestBuffer<int32_t>(kSampleFormatS32, channel_layout, 1, 1, 4));
237 buffer.Append( 238 buffer.Append(
238 MakeTestBuffer<int32_t>(kSampleFormatS32, channel_layout, 9, 1, 20)); 239 MakeTestBuffer<int32_t>(kSampleFormatS32, channel_layout, 9, 1, 20));
239 EXPECT_EQ(24, buffer.frames()); 240 EXPECT_EQ(24, buffer.frames());
240 241
241 // Read 6 frames from the buffer. 242 // Read 6 frames from the buffer.
242 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, 100); 243 std::unique_ptr<AudioBus> bus = AudioBus::Create(channels, 100);
243 EXPECT_EQ(6, buffer.ReadFrames(6, 0, bus.get())); 244 EXPECT_EQ(6, buffer.ReadFrames(6, 0, bus.get()));
244 EXPECT_EQ(18, buffer.frames()); 245 EXPECT_EQ(18, buffer.frames());
245 VerifyBus(bus.get(), 0, 4, 4, 1.0f / std::numeric_limits<int32_t>::max(), 246 VerifyBus(bus.get(), 0, 4, 4, 1.0f / std::numeric_limits<int32_t>::max(),
246 1.0f / std::numeric_limits<int32_t>::max()); 247 1.0f / std::numeric_limits<int32_t>::max());
247 VerifyBus(bus.get(), 4, 2, 20, 9.0f / std::numeric_limits<int32_t>::max(), 248 VerifyBus(bus.get(), 4, 2, 20, 9.0f / std::numeric_limits<int32_t>::max(),
248 1.0f / std::numeric_limits<int32_t>::max()); 249 1.0f / std::numeric_limits<int32_t>::max());
249 250
250 // Read the next 2 frames. 251 // Read the next 2 frames.
251 EXPECT_EQ(2, buffer.ReadFrames(2, 0, bus.get())); 252 EXPECT_EQ(2, buffer.ReadFrames(2, 0, bus.get()));
252 EXPECT_EQ(16, buffer.frames()); 253 EXPECT_EQ(16, buffer.frames());
253 VerifyBus(bus.get(), 0, 2, 20, 11.0f / std::numeric_limits<int32_t>::max(), 254 VerifyBus(bus.get(), 0, 2, 20, 11.0f / std::numeric_limits<int32_t>::max(),
254 1.0f / std::numeric_limits<int32_t>::max()); 255 1.0f / std::numeric_limits<int32_t>::max());
255 } 256 }
256 257
257 TEST(AudioBufferQueueTest, ReadF32Planar) { 258 TEST(AudioBufferQueueTest, ReadF32Planar) {
258 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; 259 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
259 const int channels = ChannelLayoutToChannelCount(channel_layout); 260 const int channels = ChannelLayoutToChannelCount(channel_layout);
260 AudioBufferQueue buffer; 261 AudioBufferQueue buffer;
261 262
262 // Add 14 frames of data. 263 // Add 14 frames of data.
263 buffer.Append(MakeTestBuffer<float>( 264 buffer.Append(MakeTestBuffer<float>(
264 kSampleFormatPlanarF32, channel_layout, 1.0f, 1.0f, 4)); 265 kSampleFormatPlanarF32, channel_layout, 1.0f, 1.0f, 4));
265 buffer.Append(MakeTestBuffer<float>( 266 buffer.Append(MakeTestBuffer<float>(
266 kSampleFormatPlanarF32, channel_layout, 50.0f, 1.0f, 10)); 267 kSampleFormatPlanarF32, channel_layout, 50.0f, 1.0f, 10));
267 EXPECT_EQ(14, buffer.frames()); 268 EXPECT_EQ(14, buffer.frames());
268 269
269 // Read 6 frames from the buffer. 270 // Read 6 frames from the buffer.
270 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, 100); 271 std::unique_ptr<AudioBus> bus = AudioBus::Create(channels, 100);
271 EXPECT_EQ(6, buffer.ReadFrames(6, 0, bus.get())); 272 EXPECT_EQ(6, buffer.ReadFrames(6, 0, bus.get()));
272 EXPECT_EQ(8, buffer.frames()); 273 EXPECT_EQ(8, buffer.frames());
273 VerifyBus(bus.get(), 0, 4, 4, 1, 1); 274 VerifyBus(bus.get(), 0, 4, 4, 1, 1);
274 VerifyBus(bus.get(), 4, 2, 10, 50, 1); 275 VerifyBus(bus.get(), 4, 2, 10, 50, 1);
275 } 276 }
276 277
277 TEST(AudioBufferQueueTest, ReadS16Planar) { 278 TEST(AudioBufferQueueTest, ReadS16Planar) {
278 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; 279 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
279 const int channels = ChannelLayoutToChannelCount(channel_layout); 280 const int channels = ChannelLayoutToChannelCount(channel_layout);
280 AudioBufferQueue buffer; 281 AudioBufferQueue buffer;
281 282
282 // Add 24 frames of data. 283 // Add 24 frames of data.
283 buffer.Append( 284 buffer.Append(
284 MakeTestBuffer<int16_t>(kSampleFormatPlanarS16, channel_layout, 1, 1, 4)); 285 MakeTestBuffer<int16_t>(kSampleFormatPlanarS16, channel_layout, 1, 1, 4));
285 buffer.Append(MakeTestBuffer<int16_t>(kSampleFormatPlanarS16, channel_layout, 286 buffer.Append(MakeTestBuffer<int16_t>(kSampleFormatPlanarS16, channel_layout,
286 5, 1, 20)); 287 5, 1, 20));
287 EXPECT_EQ(24, buffer.frames()); 288 EXPECT_EQ(24, buffer.frames());
288 289
289 // Read 6 frames from the buffer. 290 // Read 6 frames from the buffer.
290 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, 100); 291 std::unique_ptr<AudioBus> bus = AudioBus::Create(channels, 100);
291 EXPECT_EQ(6, buffer.ReadFrames(6, 0, bus.get())); 292 EXPECT_EQ(6, buffer.ReadFrames(6, 0, bus.get()));
292 EXPECT_EQ(18, buffer.frames()); 293 EXPECT_EQ(18, buffer.frames());
293 VerifyBus(bus.get(), 0, 4, 4, 1.0f / std::numeric_limits<int16_t>::max(), 294 VerifyBus(bus.get(), 0, 4, 4, 1.0f / std::numeric_limits<int16_t>::max(),
294 1.0f / std::numeric_limits<int16_t>::max()); 295 1.0f / std::numeric_limits<int16_t>::max());
295 VerifyBus(bus.get(), 4, 2, 20, 5.0f / std::numeric_limits<int16_t>::max(), 296 VerifyBus(bus.get(), 4, 2, 20, 5.0f / std::numeric_limits<int16_t>::max(),
296 1.0f / std::numeric_limits<int16_t>::max()); 297 1.0f / std::numeric_limits<int16_t>::max());
297 } 298 }
298 299
299 TEST(AudioBufferQueueTest, ReadManyChannels) { 300 TEST(AudioBufferQueueTest, ReadManyChannels) {
300 const ChannelLayout channel_layout = CHANNEL_LAYOUT_OCTAGONAL; 301 const ChannelLayout channel_layout = CHANNEL_LAYOUT_OCTAGONAL;
301 const int channels = ChannelLayoutToChannelCount(channel_layout); 302 const int channels = ChannelLayoutToChannelCount(channel_layout);
302 AudioBufferQueue buffer; 303 AudioBufferQueue buffer;
303 304
304 // Add 76 frames of data. 305 // Add 76 frames of data.
305 buffer.Append( 306 buffer.Append(
306 MakeTestBuffer<float>(kSampleFormatF32, channel_layout, 0.0f, 1.0f, 6)); 307 MakeTestBuffer<float>(kSampleFormatF32, channel_layout, 0.0f, 1.0f, 6));
307 buffer.Append(MakeTestBuffer<float>( 308 buffer.Append(MakeTestBuffer<float>(
308 kSampleFormatF32, channel_layout, 6.0f * channels, 1.0f, 10)); 309 kSampleFormatF32, channel_layout, 6.0f * channels, 1.0f, 10));
309 buffer.Append(MakeTestBuffer<float>( 310 buffer.Append(MakeTestBuffer<float>(
310 kSampleFormatF32, channel_layout, 16.0f * channels, 1.0f, 60)); 311 kSampleFormatF32, channel_layout, 16.0f * channels, 1.0f, 60));
311 EXPECT_EQ(76, buffer.frames()); 312 EXPECT_EQ(76, buffer.frames());
312 313
313 // Read 3 frames from the buffer. 314 // Read 3 frames from the buffer.
314 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, 100); 315 std::unique_ptr<AudioBus> bus = AudioBus::Create(channels, 100);
315 EXPECT_EQ(30, buffer.ReadFrames(30, 0, bus.get())); 316 EXPECT_EQ(30, buffer.ReadFrames(30, 0, bus.get()));
316 EXPECT_EQ(46, buffer.frames()); 317 EXPECT_EQ(46, buffer.frames());
317 VerifyBus(bus.get(), 0, 6, 6, 0, 1); 318 VerifyBus(bus.get(), 0, 6, 6, 0, 1);
318 VerifyBus(bus.get(), 6, 10, 10, 6 * channels, 1); 319 VerifyBus(bus.get(), 6, 10, 10, 6 * channels, 1);
319 VerifyBus(bus.get(), 16, 14, 60, 16 * channels, 1); 320 VerifyBus(bus.get(), 16, 14, 60, 16 * channels, 1);
320 } 321 }
321 322
322 TEST(AudioBufferQueueTest, Peek) { 323 TEST(AudioBufferQueueTest, Peek) {
323 const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0; 324 const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0;
324 const int channels = ChannelLayoutToChannelCount(channel_layout); 325 const int channels = ChannelLayoutToChannelCount(channel_layout);
325 AudioBufferQueue buffer; 326 AudioBufferQueue buffer;
326 327
327 // Add 60 frames of data. 328 // Add 60 frames of data.
328 const int frames = 60; 329 const int frames = 60;
329 buffer.Append(MakeTestBuffer<float>( 330 buffer.Append(MakeTestBuffer<float>(
330 kSampleFormatF32, channel_layout, 0.0f, 1.0f, frames)); 331 kSampleFormatF32, channel_layout, 0.0f, 1.0f, frames));
331 EXPECT_EQ(frames, buffer.frames()); 332 EXPECT_EQ(frames, buffer.frames());
332 333
333 // Peek at the first 30 frames. 334 // Peek at the first 30 frames.
334 scoped_ptr<AudioBus> bus1 = AudioBus::Create(channels, frames); 335 std::unique_ptr<AudioBus> bus1 = AudioBus::Create(channels, frames);
335 EXPECT_EQ(frames, buffer.frames()); 336 EXPECT_EQ(frames, buffer.frames());
336 EXPECT_EQ(frames, buffer.PeekFrames(60, 0, 0, bus1.get())); 337 EXPECT_EQ(frames, buffer.PeekFrames(60, 0, 0, bus1.get()));
337 EXPECT_EQ(30, buffer.PeekFrames(30, 0, 0, bus1.get())); 338 EXPECT_EQ(30, buffer.PeekFrames(30, 0, 0, bus1.get()));
338 EXPECT_EQ(frames, buffer.frames()); 339 EXPECT_EQ(frames, buffer.frames());
339 VerifyBus(bus1.get(), 0, 30, bus1->frames(), 0, 1); 340 VerifyBus(bus1.get(), 0, 30, bus1->frames(), 0, 1);
340 341
341 // Now read the next 30 frames (which should be the same as those peeked at). 342 // Now read the next 30 frames (which should be the same as those peeked at).
342 scoped_ptr<AudioBus> bus2 = AudioBus::Create(channels, frames); 343 std::unique_ptr<AudioBus> bus2 = AudioBus::Create(channels, frames);
343 EXPECT_EQ(30, buffer.ReadFrames(30, 0, bus2.get())); 344 EXPECT_EQ(30, buffer.ReadFrames(30, 0, bus2.get()));
344 VerifyBus(bus2.get(), 0, 30, bus2->frames(), 0, 1); 345 VerifyBus(bus2.get(), 0, 30, bus2->frames(), 0, 1);
345 346
346 // Peek 10 frames forward 347 // Peek 10 frames forward
347 bus1->Zero(); 348 bus1->Zero();
348 EXPECT_EQ(5, buffer.PeekFrames(5, 10, 0, bus1.get())); 349 EXPECT_EQ(5, buffer.PeekFrames(5, 10, 0, bus1.get()));
349 VerifyBus(bus1.get(), 0, 5, bus1->frames(), 40, 1); 350 VerifyBus(bus1.get(), 0, 5, bus1->frames(), 40, 1);
350 351
351 // Peek to the end of the buffer. 352 // Peek to the end of the buffer.
352 EXPECT_EQ(30, buffer.frames()); 353 EXPECT_EQ(30, buffer.frames());
353 EXPECT_EQ(30, buffer.PeekFrames(60, 0, 0, bus1.get())); 354 EXPECT_EQ(30, buffer.PeekFrames(60, 0, 0, bus1.get()));
354 EXPECT_EQ(30, buffer.PeekFrames(30, 0, 0, bus1.get())); 355 EXPECT_EQ(30, buffer.PeekFrames(30, 0, 0, bus1.get()));
355 } 356 }
356 357
357 } // namespace media 358 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698