OLD | NEW |
---|---|
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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 3251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3262 AppendSingleStreamCluster(kSourceId, kVideoTrackNum, | 3262 AppendSingleStreamCluster(kSourceId, kVideoTrackNum, |
3263 "1K 31 61 91 121K 151 181"); | 3263 "1K 31 61 91 121K 151 181"); |
3264 AppendSingleStreamCluster(kSourceId, kTextTrackNum, "1K 101K 201K"); | 3264 AppendSingleStreamCluster(kSourceId, kTextTrackNum, "1K 101K 201K"); |
3265 | 3265 |
3266 Seek(base::TimeDelta()); | 3266 Seek(base::TimeDelta()); |
3267 CheckExpectedBuffers(audio_stream, "1 21 41 61 81 101 121 141"); | 3267 CheckExpectedBuffers(audio_stream, "1 21 41 61 81 101 121 141"); |
3268 CheckExpectedBuffers(video_stream, "1 31 61 91 121 151 181"); | 3268 CheckExpectedBuffers(video_stream, "1 31 61 91 121 151 181"); |
3269 CheckExpectedBuffers(text_stream, "1 101 201"); | 3269 CheckExpectedBuffers(text_stream, "1 101 201"); |
3270 } | 3270 } |
3271 | 3271 |
3272 TEST_P(ChunkDemuxerTest, Remove_StartAtDuration) { | |
3273 ASSERT_TRUE(InitDemuxer(HAS_AUDIO)); | |
3274 DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO); | |
3275 | |
3276 AppendSingleStreamCluster(kSourceId, kAudioTrackNum, | |
3277 "0K 20K 40K 60K 80K 100K 120K 140K"); | |
3278 | |
3279 CheckExpectedRanges(kSourceId, "{ [0,160) }"); | |
3280 CheckExpectedBuffers(audio_stream, "0 20 40 60 80 100 120 140"); | |
3281 | |
3282 demuxer_->Remove(kSourceId, | |
3283 base::TimeDelta::FromSecondsD(demuxer_->GetDuration()), | |
wolenetz
2014/06/05 23:27:32
demuxer_->GetDuration() will be much larger than 1
acolwell GONE FROM CHROMIUM
2014/06/06 00:40:07
Done.
| |
3284 kInfiniteDuration()); | |
3285 | |
3286 Seek(base::TimeDelta()); | |
3287 CheckExpectedRanges(kSourceId, "{ [0,160) }"); | |
3288 CheckExpectedBuffers(audio_stream, "0 20 40 60 80 100 120 140"); | |
3289 } | |
3290 | |
3272 // Verifies that a Seek() will complete without text cues for | 3291 // Verifies that a Seek() will complete without text cues for |
3273 // the seek point and will return cues after the seek position | 3292 // the seek point and will return cues after the seek position |
3274 // when they are eventually appended. | 3293 // when they are eventually appended. |
3275 TEST_P(ChunkDemuxerTest, SeekCompletesWithoutTextCues) { | 3294 TEST_P(ChunkDemuxerTest, SeekCompletesWithoutTextCues) { |
3276 DemuxerStream* text_stream = NULL; | 3295 DemuxerStream* text_stream = NULL; |
3277 EXPECT_CALL(host_, AddTextStream(_, _)) | 3296 EXPECT_CALL(host_, AddTextStream(_, _)) |
3278 .WillOnce(SaveArg<0>(&text_stream)); | 3297 .WillOnce(SaveArg<0>(&text_stream)); |
3279 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO | HAS_TEXT)); | 3298 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO | HAS_TEXT)); |
3280 | 3299 |
3281 DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO); | 3300 DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3326 CheckExpectedBuffers(audio_stream, "160 180"); | 3345 CheckExpectedBuffers(audio_stream, "160 180"); |
3327 CheckExpectedBuffers(video_stream, "180 210"); | 3346 CheckExpectedBuffers(video_stream, "180 210"); |
3328 } | 3347 } |
3329 | 3348 |
3330 // Generate two sets of tests: one using FrameProcessor, and one using | 3349 // Generate two sets of tests: one using FrameProcessor, and one using |
3331 // LegacyFrameProcessor. | 3350 // LegacyFrameProcessor. |
3332 INSTANTIATE_TEST_CASE_P(NewFrameProcessor, ChunkDemuxerTest, Values(false)); | 3351 INSTANTIATE_TEST_CASE_P(NewFrameProcessor, ChunkDemuxerTest, Values(false)); |
3333 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, ChunkDemuxerTest, Values(true)); | 3352 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, ChunkDemuxerTest, Values(true)); |
3334 | 3353 |
3335 } // namespace media | 3354 } // namespace media |
OLD | NEW |