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 2481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2492 | 2492 |
2493 CheckExpectedRanges("{ [0,132) }"); | 2493 CheckExpectedRanges("{ [0,132) }"); |
2494 | 2494 |
2495 // Append a disjoint cluster to check for two separate ranges. | 2495 // Append a disjoint cluster to check for two separate ranges. |
2496 AppendCluster(GenerateSingleStreamCluster( | 2496 AppendCluster(GenerateSingleStreamCluster( |
2497 200, 299, kVideoTrackNum, kVideoBlockDuration)); | 2497 200, 299, kVideoTrackNum, kVideoBlockDuration)); |
2498 | 2498 |
2499 CheckExpectedRanges("{ [0,132) [200,299) }"); | 2499 CheckExpectedRanges("{ [0,132) [200,299) }"); |
2500 } | 2500 } |
2501 | 2501 |
2502 TEST_F(ChunkDemuxerTest, GetBufferedRanges_AudioVideo) { | 2502 TEST_F(ChunkDemuxerTest, GetBufferedRanges_AudioVideo_SingleStreamClusters) { |
2503 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); | 2503 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); |
2504 | 2504 |
2505 // Audio: 0 -> 23 | 2505 // Audio: 0 -> 23 |
2506 // Video: 0 -> 33 | 2506 // Video: 0 -> 33 |
2507 // Buffered Range: 0 -> 23 | 2507 // Buffered Range: 0 -> 23 |
2508 // Audio block duration is smaller than video block duration, | 2508 // Audio block duration is smaller than video block duration, |
2509 // so the buffered ranges should correspond to the audio blocks. | 2509 // so the buffered ranges should correspond to the audio blocks. |
2510 AppendCluster(GenerateSingleStreamCluster( | 2510 AppendCluster(GenerateSingleStreamCluster( |
2511 0, kAudioBlockDuration, kAudioTrackNum, kAudioBlockDuration)); | 2511 0, kAudioBlockDuration, kAudioTrackNum, kAudioBlockDuration)); |
2512 AppendCluster(GenerateSingleStreamCluster( | 2512 AppendCluster(GenerateSingleStreamCluster( |
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3848 // audio size is 80 bytes, new data is 28 bytes, we need to remove just one 10 | 3848 // audio size is 80 bytes, new data is 28 bytes, we need to remove just one 10 |
3849 // byte block to stay under 100 bytes memory limit after append | 3849 // byte block to stay under 100 bytes memory limit after append |
3850 // 80 - 10 + 28 = 98). | 3850 // 80 - 10 + 28 = 98). |
3851 // For video stream 150 + 52 = 202. Video limit is 150 bytes. We need to | 3851 // For video stream 150 + 52 = 202. Video limit is 150 bytes. We need to |
3852 // remove at least 6 blocks to stay under limit. | 3852 // remove at least 6 blocks to stay under limit. |
3853 CheckExpectedBuffers(audio_stream, "40K 80K 120K 160K 200K 240K 280K"); | 3853 CheckExpectedBuffers(audio_stream, "40K 80K 120K 160K 200K 240K 280K"); |
3854 CheckExpectedBuffers(video_stream, "60K 70 80K 90 100K 110 120K 130 140K"); | 3854 CheckExpectedBuffers(video_stream, "60K 70 80K 90 100K 110 120K 130 140K"); |
3855 } | 3855 } |
3856 | 3856 |
3857 } // namespace media | 3857 } // namespace media |
OLD | NEW |