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

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

Issue 1281113002: MSE: Warn when keyframe after track_buffer is significantly in future (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed DCHECK, added tests, need to fix log resulting from one of new tests Created 5 years, 4 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 "media/filters/source_buffer_stream.h" 5 #include "media/filters/source_buffer_stream.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 4267 matching lines...) Expand 10 before | Expand all | Expand 10 after
4278 CheckVideoConfig(video_config_); 4278 CheckVideoConfig(video_config_);
4279 CheckExpectedBuffers("2000K 2010 2020D10"); 4279 CheckExpectedBuffers("2000K 2010 2020D10");
4280 CheckVideoConfig(video_config_); 4280 CheckVideoConfig(video_config_);
4281 EXPECT_EQ(stream_->GetNextBuffer(&buffer), SourceBufferStream::kConfigChange); 4281 EXPECT_EQ(stream_->GetNextBuffer(&buffer), SourceBufferStream::kConfigChange);
4282 CheckVideoConfig(new_config); 4282 CheckVideoConfig(new_config);
4283 CheckExpectedBuffers("2030K 2040 2050D10"); 4283 CheckExpectedBuffers("2030K 2040 2050D10");
4284 CheckNoNextBuffer(); 4284 CheckNoNextBuffer();
4285 CheckVideoConfig(new_config); 4285 CheckVideoConfig(new_config);
4286 } 4286 }
4287 4287
4288 TEST_F(SourceBufferStreamTest,
4289 TrackBuffer_WithDelayUntilNextKeyframeInOverlap) {
4290 NewSegmentAppend("0K 10 20 30 40");
4291
4292 // Read the first 4 buffers, so next buffer is at time 40.
4293 Seek(0);
4294 CheckExpectedRangesByTimestamp("{ [0,50) }");
4295 CheckExpectedBuffers("0K 10 20 30");
4296
4297 // Overlap-append, populating track buffer with timestamp 40 from original
4298 // append. Confirm there could be a large jump in time until the next key
4299 // frame after exhausting the track buffer.
4300 NewSegmentAppend(
4301 "31K 41 51 61 71 81 91 101 111 121 "
4302 "131K 141");
4303 CheckExpectedRangesByTimestamp("{ [0,151) }");
4304 // Confirm the large jump. If this test is changed, update
4305 // TrackBufferExhaustion_ImmediateNewTrackBuffer accordingly.
4306 CheckExpectedBuffers("40 131K 141");
4307 CheckNoNextBuffer();
4308 }
4309
4310 TEST_F(SourceBufferStreamTest,
4311 TrackBuffer_ExhaustionAndImmediateNewTrackBuffer) {
4312 NewSegmentAppend("0K 10 20 30 40");
4313
4314 // Read the first 4 buffers, so next buffer is at time 40.
4315 Seek(0);
4316 CheckExpectedRangesByTimestamp("{ [0,50) }");
4317 CheckExpectedBuffers("0K 10 20 30");
4318
4319 // Overlap-append
4320 NewSegmentAppend(
4321 "31K 41 51 61 71 81 91 101 111 121 "
4322 "131K 141");
4323 CheckExpectedRangesByTimestamp("{ [0,151) }");
4324
4325 // Exhaust the track buffer, but don't read any of the overlapping append yet.
4326 CheckExpectedBuffers("40");
4327
4328 // Selected range's next buffer is now the 131K buffer from the overlapping
4329 // append. (See TrackBuffer_WithDelayUntilNextKeyframeInOverlap for
4330 // confirmation.)
4331 // Do another overlap-append to immediately create another track buffer and
4332 // verify.
4333 NewSegmentAppend("22K 32 42 52 62 72 82 92 102 112 122K 132 142 152K 162");
4334 CheckExpectedRangesByTimestamp("{ [0,172) }");
4335
4336 //**********
4337 // BIG TODO: The following outputs to MediaLog a message understating the
4338 // actual gap. Actual gap is time 40->131K==91ms. Log shows 11ms==141->152K.
4339 // Fix the implementation and perhaps verify the log with a MockMediaLog?
4340 //**********
4341
4342 CheckExpectedBuffers("131K 141 152K 162");
4343 CheckNoNextBuffer();
4344 }
4345
4288 // TODO(vrk): Add unit tests where keyframes are unaligned between streams. 4346 // TODO(vrk): Add unit tests where keyframes are unaligned between streams.
4289 // (crbug.com/133557) 4347 // (crbug.com/133557)
4290 4348
4291 // TODO(vrk): Add unit tests with end of stream being called at interesting 4349 // TODO(vrk): Add unit tests with end of stream being called at interesting
4292 // times. 4350 // times.
4293 4351
4294 } // namespace media 4352 } // namespace media
OLDNEW
« media/filters/source_buffer_stream.cc ('K') | « media/filters/source_buffer_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698