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

Side by Side Diff: media/filters/chunk_demuxer_unittest.cc

Issue 1347483003: Fix seeking back in the new MSE GC algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: upd Created 5 years, 3 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 (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 3394 matching lines...) Expand 10 before | Expand all | Expand 10 after
3405 demuxer_->Seek(seek_time2, NewExpectedStatusCB(PIPELINE_OK)); 3405 demuxer_->Seek(seek_time2, NewExpectedStatusCB(PIPELINE_OK));
3406 3406
3407 // Append more data and make sure that we preserve both the buffered range 3407 // Append more data and make sure that we preserve both the buffered range
3408 // around |seek_time2|, because that's the current playback position, 3408 // around |seek_time2|, because that's the current playback position,
3409 // and the newly appended range, since this is the most recent append. 3409 // and the newly appended range, since this is the most recent append.
3410 AppendSingleStreamCluster(kSourceId, kAudioTrackNum, 700, 5); 3410 AppendSingleStreamCluster(kSourceId, kAudioTrackNum, 700, 5);
3411 EXPECT_FALSE(demuxer_->EvictCodedFrames(kSourceId, seek_time2, 0)); 3411 EXPECT_FALSE(demuxer_->EvictCodedFrames(kSourceId, seek_time2, 0));
3412 CheckExpectedRanges(kSourceId, "{ [500,615) [700,815) }"); 3412 CheckExpectedRanges(kSourceId, "{ [500,615) [700,815) }");
3413 } 3413 }
3414 3414
3415 TEST_F(ChunkDemuxerTest, GCDuringSeekBack) {
3416 ASSERT_TRUE(InitDemuxer(HAS_AUDIO));
3417 demuxer_->SetMemoryLimits(DemuxerStream::AUDIO, 10 * kBlockSize);
3418 // Append some data at position 1000ms
3419 AppendSingleStreamCluster(kSourceId, kAudioTrackNum, 1000, 10);
3420 CheckExpectedRanges(kSourceId, "{ [1000,1230) }");
3421
3422 // GC should be able to evict frames in the currently buffered range, since
3423 // those frames are later than the seek target position 0.
3424 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(0);
3425 EXPECT_TRUE(demuxer_->EvictCodedFrames(kSourceId, seek_time, 5 * kBlockSize));
wolenetz 2015/09/16 19:25:27 nit: We could do a further check of expectation he
3426 }
3427
3415 TEST_F(ChunkDemuxerTest, GCKeepPlayhead) { 3428 TEST_F(ChunkDemuxerTest, GCKeepPlayhead) {
3416 ASSERT_TRUE(InitDemuxer(HAS_AUDIO)); 3429 ASSERT_TRUE(InitDemuxer(HAS_AUDIO));
3417 3430
3418 demuxer_->SetMemoryLimits(DemuxerStream::AUDIO, 5 * kBlockSize); 3431 demuxer_->SetMemoryLimits(DemuxerStream::AUDIO, 5 * kBlockSize);
3419 3432
3420 // Append data at the start that can be garbage collected: 3433 // Append data at the start that can be garbage collected:
3421 AppendSingleStreamCluster(kSourceId, kAudioTrackNum, 0, 10); 3434 AppendSingleStreamCluster(kSourceId, kAudioTrackNum, 0, 10);
3422 CheckExpectedRanges(kSourceId, "{ [0,230) }"); 3435 CheckExpectedRanges(kSourceId, "{ [0,230) }");
3423 3436
3424 // We expect garbage collection to fail, as we don't want to spontaneously 3437 // We expect garbage collection to fail, as we don't want to spontaneously
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
3848 // audio size is 80 bytes, new data is 28 bytes, we need to remove just one 10 3861 // 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 3862 // byte block to stay under 100 bytes memory limit after append
3850 // 80 - 10 + 28 = 98). 3863 // 80 - 10 + 28 = 98).
3851 // For video stream 150 + 52 = 202. Video limit is 150 bytes. We need to 3864 // For video stream 150 + 52 = 202. Video limit is 150 bytes. We need to
3852 // remove at least 6 blocks to stay under limit. 3865 // remove at least 6 blocks to stay under limit.
3853 CheckExpectedBuffers(audio_stream, "40K 80K 120K 160K 200K 240K 280K"); 3866 CheckExpectedBuffers(audio_stream, "40K 80K 120K 160K 200K 240K 280K");
3854 CheckExpectedBuffers(video_stream, "60K 70 80K 90 100K 110 120K 130 140K"); 3867 CheckExpectedBuffers(video_stream, "60K 70 80K 90 100K 110 120K 130 140K");
3855 } 3868 }
3856 3869
3857 } // namespace media 3870 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/source_buffer_stream.cc » ('j') | media/filters/source_buffer_stream.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698