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 28 matching lines...) Expand all Loading... |
39 }; | 39 }; |
40 | 40 |
41 // WebM Block bytes that represent a VP8 keyframe. | 41 // WebM Block bytes that represent a VP8 keyframe. |
42 const uint8 kVP8Keyframe[] = { | 42 const uint8 kVP8Keyframe[] = { |
43 0x010, 0x00, 0x00, 0x9d, 0x01, 0x2a, 0x00, 0x10, 0x00, 0x10, 0x00 | 43 0x010, 0x00, 0x00, 0x9d, 0x01, 0x2a, 0x00, 0x10, 0x00, 0x10, 0x00 |
44 }; | 44 }; |
45 | 45 |
46 // WebM Block bytes that represent a VP8 interframe. | 46 // WebM Block bytes that represent a VP8 interframe. |
47 const uint8 kVP8Interframe[] = { 0x11, 0x00, 0x00 }; | 47 const uint8 kVP8Interframe[] = { 0x11, 0x00, 0x00 }; |
48 | 48 |
| 49 static const uint8 kCuesHeader[] = { |
| 50 0x1C, 0x53, 0xBB, 0x6B, // Cues ID |
| 51 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cues(size = 0) |
| 52 }; |
| 53 |
| 54 |
49 const int kTracksHeaderSize = sizeof(kTracksHeader); | 55 const int kTracksHeaderSize = sizeof(kTracksHeader); |
50 const int kTracksSizeOffset = 4; | 56 const int kTracksSizeOffset = 4; |
51 | 57 |
52 // The size of TrackEntry element in test file "webm_vorbis_track_entry" starts | 58 // The size of TrackEntry element in test file "webm_vorbis_track_entry" starts |
53 // at index 1 and spans 8 bytes. | 59 // at index 1 and spans 8 bytes. |
54 const int kAudioTrackSizeOffset = 1; | 60 const int kAudioTrackSizeOffset = 1; |
55 const int kAudioTrackSizeWidth = 8; | 61 const int kAudioTrackSizeWidth = 8; |
56 const int kAudioTrackEntryHeaderSize = | 62 const int kAudioTrackEntryHeaderSize = |
57 kAudioTrackSizeOffset + kAudioTrackSizeWidth; | 63 kAudioTrackSizeOffset + kAudioTrackSizeWidth; |
58 | 64 |
(...skipping 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3473 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); | 3479 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); |
3474 | 3480 |
3475 AppendCluster(GenerateCluster(0, 0, 4, true)); | 3481 AppendCluster(GenerateCluster(0, 0, 4, true)); |
3476 CheckExpectedRanges(kSourceId, "{ [0,46) }"); | 3482 CheckExpectedRanges(kSourceId, "{ [0,46) }"); |
3477 | 3483 |
3478 // A new cluster indicates end of the previous cluster with unknown size. | 3484 // A new cluster indicates end of the previous cluster with unknown size. |
3479 AppendCluster(GenerateCluster(46, 66, 5, true)); | 3485 AppendCluster(GenerateCluster(46, 66, 5, true)); |
3480 CheckExpectedRanges(kSourceId, "{ [0,115) }"); | 3486 CheckExpectedRanges(kSourceId, "{ [0,115) }"); |
3481 } | 3487 } |
3482 | 3488 |
| 3489 TEST_P(ChunkDemuxerTest, CuesBetweenClusters) { |
| 3490 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); |
| 3491 |
| 3492 AppendCluster(GenerateCluster(0, 0, 4)); |
| 3493 AppendData(kCuesHeader, sizeof(kCuesHeader)); |
| 3494 AppendCluster(GenerateCluster(46, 66, 5)); |
| 3495 CheckExpectedRanges(kSourceId, "{ [0,115) }"); |
| 3496 } |
| 3497 |
3483 // Generate two sets of tests: one using FrameProcessor, and one using | 3498 // Generate two sets of tests: one using FrameProcessor, and one using |
3484 // LegacyFrameProcessor. | 3499 // LegacyFrameProcessor. |
3485 INSTANTIATE_TEST_CASE_P(NewFrameProcessor, ChunkDemuxerTest, Values(false)); | 3500 INSTANTIATE_TEST_CASE_P(NewFrameProcessor, ChunkDemuxerTest, Values(false)); |
3486 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, ChunkDemuxerTest, Values(true)); | 3501 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, ChunkDemuxerTest, Values(true)); |
3487 | 3502 |
3488 } // namespace media | 3503 } // namespace media |
OLD | NEW |