| OLD | NEW |
| 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 "base/strings/string_util.h" | 5 #include "base/strings/string_util.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "media/base/audio_buffer.h" | 7 #include "media/base/audio_buffer.h" |
| 8 #include "media/base/audio_bus.h" | 8 #include "media/base/audio_bus.h" |
| 9 #include "media/base/test_helpers.h" | 9 #include "media/base/test_helpers.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 ASSERT_EQ(channel_data[i], start); | 23 ASSERT_EQ(channel_data[i], start); |
| 24 start += increment; | 24 start += increment; |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 | 27 |
| 28 TEST(AudioBufferTest, CopyFrom) { | 28 TEST(AudioBufferTest, CopyFrom) { |
| 29 const ChannelLayout channel_layout = CHANNEL_LAYOUT_MONO; | 29 const ChannelLayout channel_layout = CHANNEL_LAYOUT_MONO; |
| 30 const int frames = 8; | 30 const int frames = 8; |
| 31 const base::TimeDelta start_time; | 31 const base::TimeDelta start_time; |
| 32 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); | 32 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); |
| 33 scoped_refptr<AudioBuffer> buffer = MakeAudioBuffer<uint8>(kSampleFormatU8, | 33 scoped_refptr<AudioBuffer> buffer = |
| 34 channel_layout, | 34 MakeAudioBuffer<uint8>(kSampleFormatU8, |
| 35 kSampleRate, | 35 channel_layout, |
| 36 1, | 36 ChannelLayoutToChannelCount(channel_layout), |
| 37 1, | 37 kSampleRate, |
| 38 frames, | 38 1, |
| 39 start_time, | 39 1, |
| 40 duration); | 40 frames, |
| 41 start_time, |
| 42 duration); |
| 41 EXPECT_EQ(frames, buffer->frame_count()); | 43 EXPECT_EQ(frames, buffer->frame_count()); |
| 42 EXPECT_EQ(buffer->timestamp(), start_time); | 44 EXPECT_EQ(buffer->timestamp(), start_time); |
| 43 EXPECT_EQ(buffer->duration().InSeconds(), frames); | 45 EXPECT_EQ(buffer->duration().InSeconds(), frames); |
| 44 EXPECT_FALSE(buffer->end_of_stream()); | 46 EXPECT_FALSE(buffer->end_of_stream()); |
| 45 } | 47 } |
| 46 | 48 |
| 47 TEST(AudioBufferTest, CreateEOSBuffer) { | 49 TEST(AudioBufferTest, CreateEOSBuffer) { |
| 48 scoped_refptr<AudioBuffer> buffer = AudioBuffer::CreateEOSBuffer(); | 50 scoped_refptr<AudioBuffer> buffer = AudioBuffer::CreateEOSBuffer(); |
| 49 EXPECT_TRUE(buffer->end_of_stream()); | 51 EXPECT_TRUE(buffer->end_of_stream()); |
| 50 } | 52 } |
| 51 | 53 |
| 52 TEST(AudioBufferTest, FrameSize) { | 54 TEST(AudioBufferTest, FrameSize) { |
| 53 const uint8 kTestData[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | 55 const uint8 kTestData[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 54 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, | 56 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
| 55 27, 28, 29, 30, 31 }; | 57 27, 28, 29, 30, 31 }; |
| 56 const base::TimeDelta kTimestampA = base::TimeDelta::FromMicroseconds(1337); | 58 const base::TimeDelta kTimestampA = base::TimeDelta::FromMicroseconds(1337); |
| 57 const base::TimeDelta kTimestampB = base::TimeDelta::FromMicroseconds(1234); | 59 const base::TimeDelta kTimestampB = base::TimeDelta::FromMicroseconds(1234); |
| 58 | 60 |
| 59 const uint8* const data[] = { kTestData }; | 61 const uint8* const data[] = { kTestData }; |
| 60 scoped_refptr<AudioBuffer> buffer = | 62 scoped_refptr<AudioBuffer> buffer = |
| 61 AudioBuffer::CopyFrom(kSampleFormatU8, | 63 AudioBuffer::CopyFrom(kSampleFormatU8, |
| 62 CHANNEL_LAYOUT_STEREO, | 64 CHANNEL_LAYOUT_STEREO, |
| 65 2, |
| 63 kSampleRate, | 66 kSampleRate, |
| 64 16, | 67 16, |
| 65 data, | 68 data, |
| 66 kTimestampA, | 69 kTimestampA, |
| 67 kTimestampB); | 70 kTimestampB); |
| 68 EXPECT_EQ(16, buffer->frame_count()); // 2 channels of 8-bit data | 71 EXPECT_EQ(16, buffer->frame_count()); // 2 channels of 8-bit data |
| 69 | 72 |
| 70 buffer = AudioBuffer::CopyFrom(kSampleFormatF32, | 73 buffer = AudioBuffer::CopyFrom(kSampleFormatF32, |
| 71 CHANNEL_LAYOUT_4_0, | 74 CHANNEL_LAYOUT_4_0, |
| 75 4, |
| 72 kSampleRate, | 76 kSampleRate, |
| 73 2, | 77 2, |
| 74 data, | 78 data, |
| 75 kTimestampA, | 79 kTimestampA, |
| 76 kTimestampB); | 80 kTimestampB); |
| 77 EXPECT_EQ(2, buffer->frame_count()); // now 4 channels of 32-bit data | 81 EXPECT_EQ(2, buffer->frame_count()); // now 4 channels of 32-bit data |
| 78 } | 82 } |
| 79 | 83 |
| 80 TEST(AudioBufferTest, ReadU8) { | 84 TEST(AudioBufferTest, ReadU8) { |
| 81 const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0; | 85 const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0; |
| 82 const int channels = ChannelLayoutToChannelCount(channel_layout); | 86 const int channels = ChannelLayoutToChannelCount(channel_layout); |
| 83 const int frames = 4; | 87 const int frames = 4; |
| 84 const base::TimeDelta start_time; | 88 const base::TimeDelta start_time; |
| 85 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); | 89 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); |
| 86 scoped_refptr<AudioBuffer> buffer = MakeAudioBuffer<uint8>(kSampleFormatU8, | 90 scoped_refptr<AudioBuffer> buffer = MakeAudioBuffer<uint8>(kSampleFormatU8, |
| 87 channel_layout, | 91 channel_layout, |
| 92 channels, |
| 88 kSampleRate, | 93 kSampleRate, |
| 89 128, | 94 128, |
| 90 1, | 95 1, |
| 91 frames, | 96 frames, |
| 92 start_time, | 97 start_time, |
| 93 duration); | 98 duration); |
| 94 | 99 |
| 95 // Read all 4 frames from the buffer. Data is interleaved, so ch[0] should be | 100 // Read all 4 frames from the buffer. Data is interleaved, so ch[0] should be |
| 96 // 128, 132, 136, 140, other channels similar. However, values are converted | 101 // 128, 132, 136, 140, other channels similar. However, values are converted |
| 97 // from [0, 255] to [-1.0, 1.0] with a bias of 128. Thus the first buffer | 102 // from [0, 255] to [-1.0, 1.0] with a bias of 128. Thus the first buffer |
| 98 // value should be 0.0, then 1/127, 2/127, etc. | 103 // value should be 0.0, then 1/127, 2/127, etc. |
| 99 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, 100); | 104 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, 100); |
| 100 buffer->ReadFrames(frames, 0, 0, bus.get()); | 105 buffer->ReadFrames(frames, 0, 0, bus.get()); |
| 101 VerifyResult(bus->channel(0), frames, 0.0f, 4.0f / 127.0f); | 106 VerifyResult(bus->channel(0), frames, 0.0f, 4.0f / 127.0f); |
| 102 VerifyResult(bus->channel(1), frames, 1.0f / 127.0f, 4.0f / 127.0f); | 107 VerifyResult(bus->channel(1), frames, 1.0f / 127.0f, 4.0f / 127.0f); |
| 103 VerifyResult(bus->channel(2), frames, 2.0f / 127.0f, 4.0f / 127.0f); | 108 VerifyResult(bus->channel(2), frames, 2.0f / 127.0f, 4.0f / 127.0f); |
| 104 VerifyResult(bus->channel(3), frames, 3.0f / 127.0f, 4.0f / 127.0f); | 109 VerifyResult(bus->channel(3), frames, 3.0f / 127.0f, 4.0f / 127.0f); |
| 105 } | 110 } |
| 106 | 111 |
| 107 TEST(AudioBufferTest, ReadS16) { | 112 TEST(AudioBufferTest, ReadS16) { |
| 108 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; | 113 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; |
| 109 const int channels = ChannelLayoutToChannelCount(channel_layout); | 114 const int channels = ChannelLayoutToChannelCount(channel_layout); |
| 110 const int frames = 10; | 115 const int frames = 10; |
| 111 const base::TimeDelta start_time; | 116 const base::TimeDelta start_time; |
| 112 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); | 117 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); |
| 113 scoped_refptr<AudioBuffer> buffer = MakeAudioBuffer<int16>(kSampleFormatS16, | 118 scoped_refptr<AudioBuffer> buffer = MakeAudioBuffer<int16>(kSampleFormatS16, |
| 114 channel_layout, | 119 channel_layout, |
| 120 channels, |
| 115 kSampleRate, | 121 kSampleRate, |
| 116 1, | 122 1, |
| 117 1, | 123 1, |
| 118 frames, | 124 frames, |
| 119 start_time, | 125 start_time, |
| 120 duration); | 126 duration); |
| 121 | 127 |
| 122 // Read 6 frames from the buffer. Data is interleaved, so ch[0] should be 1, | 128 // Read 6 frames from the buffer. Data is interleaved, so ch[0] should be 1, |
| 123 // 3, 5, 7, 9, 11, and ch[1] should be 2, 4, 6, 8, 10, 12. Data is converted | 129 // 3, 5, 7, 9, 11, and ch[1] should be 2, 4, 6, 8, 10, 12. Data is converted |
| 124 // to float from -1.0 to 1.0 based on int16 range. | 130 // to float from -1.0 to 1.0 based on int16 range. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 137 } | 143 } |
| 138 | 144 |
| 139 TEST(AudioBufferTest, ReadS32) { | 145 TEST(AudioBufferTest, ReadS32) { |
| 140 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; | 146 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; |
| 141 const int channels = ChannelLayoutToChannelCount(channel_layout); | 147 const int channels = ChannelLayoutToChannelCount(channel_layout); |
| 142 const int frames = 6; | 148 const int frames = 6; |
| 143 const base::TimeDelta start_time; | 149 const base::TimeDelta start_time; |
| 144 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); | 150 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); |
| 145 scoped_refptr<AudioBuffer> buffer = MakeAudioBuffer<int32>(kSampleFormatS32, | 151 scoped_refptr<AudioBuffer> buffer = MakeAudioBuffer<int32>(kSampleFormatS32, |
| 146 channel_layout, | 152 channel_layout, |
| 153 channels, |
| 147 kSampleRate, | 154 kSampleRate, |
| 148 1, | 155 1, |
| 149 1, | 156 1, |
| 150 frames, | 157 frames, |
| 151 start_time, | 158 start_time, |
| 152 duration); | 159 duration); |
| 153 | 160 |
| 154 // Read 6 frames from the buffer. Data is interleaved, so ch[0] should be 1, | 161 // Read 6 frames from the buffer. Data is interleaved, so ch[0] should be 1, |
| 155 // 3, 5, 7, 9, 11, and ch[1] should be 2, 4, 6, 8, 10, 12. Data is converted | 162 // 3, 5, 7, 9, 11, and ch[1] should be 2, 4, 6, 8, 10, 12. Data is converted |
| 156 // to float from -1.0 to 1.0 based on int32 range. | 163 // to float from -1.0 to 1.0 based on int32 range. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 167 } | 174 } |
| 168 | 175 |
| 169 TEST(AudioBufferTest, ReadF32) { | 176 TEST(AudioBufferTest, ReadF32) { |
| 170 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; | 177 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; |
| 171 const int channels = ChannelLayoutToChannelCount(channel_layout); | 178 const int channels = ChannelLayoutToChannelCount(channel_layout); |
| 172 const int frames = 20; | 179 const int frames = 20; |
| 173 const base::TimeDelta start_time; | 180 const base::TimeDelta start_time; |
| 174 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); | 181 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); |
| 175 scoped_refptr<AudioBuffer> buffer = MakeAudioBuffer<float>(kSampleFormatF32, | 182 scoped_refptr<AudioBuffer> buffer = MakeAudioBuffer<float>(kSampleFormatF32, |
| 176 channel_layout, | 183 channel_layout, |
| 184 channels, |
| 177 kSampleRate, | 185 kSampleRate, |
| 178 1.0f, | 186 1.0f, |
| 179 1.0f, | 187 1.0f, |
| 180 frames, | 188 frames, |
| 181 start_time, | 189 start_time, |
| 182 duration); | 190 duration); |
| 183 | 191 |
| 184 // Read first 10 frames from the buffer. F32 is interleaved, so ch[0] should | 192 // Read first 10 frames from the buffer. F32 is interleaved, so ch[0] should |
| 185 // be 1, 3, 5, ... and ch[1] should be 2, 4, 6, ... | 193 // be 1, 3, 5, ... and ch[1] should be 2, 4, 6, ... |
| 186 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, 100); | 194 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, 100); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 197 | 205 |
| 198 TEST(AudioBufferTest, ReadS16Planar) { | 206 TEST(AudioBufferTest, ReadS16Planar) { |
| 199 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; | 207 const ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; |
| 200 const int channels = ChannelLayoutToChannelCount(channel_layout); | 208 const int channels = ChannelLayoutToChannelCount(channel_layout); |
| 201 const int frames = 20; | 209 const int frames = 20; |
| 202 const base::TimeDelta start_time; | 210 const base::TimeDelta start_time; |
| 203 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); | 211 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); |
| 204 scoped_refptr<AudioBuffer> buffer = | 212 scoped_refptr<AudioBuffer> buffer = |
| 205 MakeAudioBuffer<int16>(kSampleFormatPlanarS16, | 213 MakeAudioBuffer<int16>(kSampleFormatPlanarS16, |
| 206 channel_layout, | 214 channel_layout, |
| 215 channels, |
| 207 kSampleRate, | 216 kSampleRate, |
| 208 1, | 217 1, |
| 209 1, | 218 1, |
| 210 frames, | 219 frames, |
| 211 start_time, | 220 start_time, |
| 212 duration); | 221 duration); |
| 213 | 222 |
| 214 // Read 6 frames from the buffer. Data is planar, so ch[0] should be 1, 2, 3, | 223 // Read 6 frames from the buffer. Data is planar, so ch[0] should be 1, 2, 3, |
| 215 // 4, 5, 6, and ch[1] should be 21, 22, 23, 24, 25, 26. Data is converted to | 224 // 4, 5, 6, and ch[1] should be 21, 22, 23, 24, 25, 26. Data is converted to |
| 216 // float from -1.0 to 1.0 based on int16 range. | 225 // float from -1.0 to 1.0 based on int16 range. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 238 | 247 |
| 239 TEST(AudioBufferTest, ReadF32Planar) { | 248 TEST(AudioBufferTest, ReadF32Planar) { |
| 240 const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0; | 249 const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0; |
| 241 const int channels = ChannelLayoutToChannelCount(channel_layout); | 250 const int channels = ChannelLayoutToChannelCount(channel_layout); |
| 242 const int frames = 100; | 251 const int frames = 100; |
| 243 const base::TimeDelta start_time; | 252 const base::TimeDelta start_time; |
| 244 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); | 253 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); |
| 245 scoped_refptr<AudioBuffer> buffer = | 254 scoped_refptr<AudioBuffer> buffer = |
| 246 MakeAudioBuffer<float>(kSampleFormatPlanarF32, | 255 MakeAudioBuffer<float>(kSampleFormatPlanarF32, |
| 247 channel_layout, | 256 channel_layout, |
| 257 channels, |
| 248 kSampleRate, | 258 kSampleRate, |
| 249 1.0f, | 259 1.0f, |
| 250 1.0f, | 260 1.0f, |
| 251 frames, | 261 frames, |
| 252 start_time, | 262 start_time, |
| 253 duration); | 263 duration); |
| 254 | 264 |
| 255 // Read all 100 frames from the buffer. F32 is planar, so ch[0] should be 1, | 265 // Read all 100 frames from the buffer. F32 is planar, so ch[0] should be 1, |
| 256 // 2, 3, 4, ..., ch[1] should be 101, 102, 103, ..., and so on for all 4 | 266 // 2, 3, 4, ..., ch[1] should be 101, 102, 103, ..., and so on for all 4 |
| 257 // channels. | 267 // channels. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 271 VerifyResult(bus->channel(3), 20, 351.0f, 1.0f); | 281 VerifyResult(bus->channel(3), 20, 351.0f, 1.0f); |
| 272 } | 282 } |
| 273 | 283 |
| 274 TEST(AudioBufferTest, EmptyBuffer) { | 284 TEST(AudioBufferTest, EmptyBuffer) { |
| 275 const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0; | 285 const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0; |
| 276 const int channels = ChannelLayoutToChannelCount(channel_layout); | 286 const int channels = ChannelLayoutToChannelCount(channel_layout); |
| 277 const int frames = 100; | 287 const int frames = 100; |
| 278 const base::TimeDelta start_time; | 288 const base::TimeDelta start_time; |
| 279 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); | 289 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); |
| 280 scoped_refptr<AudioBuffer> buffer = AudioBuffer::CreateEmptyBuffer( | 290 scoped_refptr<AudioBuffer> buffer = AudioBuffer::CreateEmptyBuffer( |
| 281 channel_layout, kSampleRate, frames, start_time, duration); | 291 channel_layout, channels, kSampleRate, frames, start_time, duration); |
| 282 EXPECT_EQ(frames, buffer->frame_count()); | 292 EXPECT_EQ(frames, buffer->frame_count()); |
| 283 EXPECT_EQ(start_time, buffer->timestamp()); | 293 EXPECT_EQ(start_time, buffer->timestamp()); |
| 284 EXPECT_EQ(frames, buffer->duration().InSeconds()); | 294 EXPECT_EQ(frames, buffer->duration().InSeconds()); |
| 285 EXPECT_FALSE(buffer->end_of_stream()); | 295 EXPECT_FALSE(buffer->end_of_stream()); |
| 286 | 296 |
| 287 // Read all 100 frames from the buffer. All data should be 0. | 297 // Read all 100 frames from the buffer. All data should be 0. |
| 288 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, 100); | 298 scoped_ptr<AudioBus> bus = AudioBus::Create(channels, 100); |
| 289 buffer->ReadFrames(frames, 0, 0, bus.get()); | 299 buffer->ReadFrames(frames, 0, 0, bus.get()); |
| 290 VerifyResult(bus->channel(0), frames, 0.0f, 0.0f); | 300 VerifyResult(bus->channel(0), frames, 0.0f, 0.0f); |
| 291 VerifyResult(bus->channel(1), frames, 0.0f, 0.0f); | 301 VerifyResult(bus->channel(1), frames, 0.0f, 0.0f); |
| 292 VerifyResult(bus->channel(2), frames, 0.0f, 0.0f); | 302 VerifyResult(bus->channel(2), frames, 0.0f, 0.0f); |
| 293 VerifyResult(bus->channel(3), frames, 0.0f, 0.0f); | 303 VerifyResult(bus->channel(3), frames, 0.0f, 0.0f); |
| 294 } | 304 } |
| 295 | 305 |
| 296 TEST(AudioBufferTest, Trim) { | 306 TEST(AudioBufferTest, Trim) { |
| 297 const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0; | 307 const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0; |
| 298 const int channels = ChannelLayoutToChannelCount(channel_layout); | 308 const int channels = ChannelLayoutToChannelCount(channel_layout); |
| 299 const int frames = 100; | 309 const int frames = 100; |
| 300 const base::TimeDelta start_time; | 310 const base::TimeDelta start_time; |
| 301 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); | 311 const base::TimeDelta duration = base::TimeDelta::FromSeconds(frames); |
| 302 scoped_refptr<AudioBuffer> buffer = | 312 scoped_refptr<AudioBuffer> buffer = |
| 303 MakeAudioBuffer<float>(kSampleFormatPlanarF32, | 313 MakeAudioBuffer<float>(kSampleFormatPlanarF32, |
| 304 channel_layout, | 314 channel_layout, |
| 315 channels, |
| 305 kSampleRate, | 316 kSampleRate, |
| 306 1.0f, | 317 1.0f, |
| 307 1.0f, | 318 1.0f, |
| 308 frames, | 319 frames, |
| 309 start_time, | 320 start_time, |
| 310 duration); | 321 duration); |
| 311 EXPECT_EQ(frames, buffer->frame_count()); | 322 EXPECT_EQ(frames, buffer->frame_count()); |
| 312 EXPECT_EQ(start_time, buffer->timestamp()); | 323 EXPECT_EQ(start_time, buffer->timestamp()); |
| 313 EXPECT_EQ(frames, buffer->duration().InSeconds()); | 324 EXPECT_EQ(frames, buffer->duration().InSeconds()); |
| 314 | 325 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 341 VerifyResult(bus->channel(0), 10, 61.0f, 1.0f); | 352 VerifyResult(bus->channel(0), 10, 61.0f, 1.0f); |
| 342 | 353 |
| 343 // Trim off the last 30 frames. | 354 // Trim off the last 30 frames. |
| 344 buffer->TrimEnd(30); | 355 buffer->TrimEnd(30); |
| 345 EXPECT_EQ(buffer->frame_count(), 0); | 356 EXPECT_EQ(buffer->frame_count(), 0); |
| 346 EXPECT_EQ(buffer->timestamp(), start_time + base::TimeDelta::FromSeconds(60)); | 357 EXPECT_EQ(buffer->timestamp(), start_time + base::TimeDelta::FromSeconds(60)); |
| 347 EXPECT_EQ(buffer->duration(), base::TimeDelta::FromSeconds(0)); | 358 EXPECT_EQ(buffer->duration(), base::TimeDelta::FromSeconds(0)); |
| 348 } | 359 } |
| 349 | 360 |
| 350 } // namespace media | 361 } // namespace media |
| OLD | NEW |