diff options
author | jinsukkim@chromium.org <jinsukkim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-07 01:40:44 +0000 |
---|---|---|
committer | jinsukkim@chromium.org <jinsukkim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-07 01:40:44 +0000 |
commit | fc9f5bb3538eb05833c5eebce5cce243f7d3620e (patch) | |
tree | 0a476307465490f392f275e55101a8baa4b54b01 /media | |
parent | a1221aea536d832d7e3d30c991f8ad1cd8b44193 (diff) | |
download | chromium_src-fc9f5bb3538eb05833c5eebce5cce243f7d3620e.zip chromium_src-fc9f5bb3538eb05833c5eebce5cce243f7d3620e.tar.gz chromium_src-fc9f5bb3538eb05833c5eebce5cce243f7d3620e.tar.bz2 |
Update selected range after truncation
Update |SourceBufferStream::selected_range_| after |TruncateAt| is called in case the range pointed to by it gets deleted.
There are situations where next_buffer_index_ remains at -1
where|ChunkDemuxer::AppendData| is invoked. This eventually
causes crash. This changes prevents such cases.
The crash is occasionally observed when YouTube MSE/EME
conformance test http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/tot.html
(41.MediaSourceDuration) is done on Android TV device.
BUG=313102
Review URL: https://codereview.chromium.org/51983002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233468 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/filters/source_buffer_stream.cc | 2 | ||||
-rw-r--r-- | media/filters/source_buffer_stream_unittest.cc | 25 |
2 files changed, 27 insertions, 0 deletions
diff --git a/media/filters/source_buffer_stream.cc b/media/filters/source_buffer_stream.cc index bf867ca..07ff497 100644 --- a/media/filters/source_buffer_stream.cc +++ b/media/filters/source_buffer_stream.cc @@ -1054,6 +1054,8 @@ void SourceBufferStream::OnSetDuration(base::TimeDelta duration) { // Need to partially truncate this range. if ((*itr)->GetStartTimestamp() < duration) { (*itr)->TruncateAt(duration, NULL, false); + if ((*itr == selected_range_) && !selected_range_->HasNextBufferPosition()) + SetSelectedRange(NULL); ++itr; } diff --git a/media/filters/source_buffer_stream_unittest.cc b/media/filters/source_buffer_stream_unittest.cc index 7b525b9..9e7373a 100644 --- a/media/filters/source_buffer_stream_unittest.cc +++ b/media/filters/source_buffer_stream_unittest.cc @@ -2864,6 +2864,31 @@ TEST_F(SourceBufferStreamTest, SetExplicitDuration_DeletePartialSelectedRange) { CheckExpectedRanges("{ [0,4) [10,10) }"); } +// Test the case where duration is set while the stream parser buffers +// already start passing the data to decoding pipeline. Selected range, +// when invalidated by getting truncated, should be updated to NULL +// accordingly so that successive append operations keep working. +TEST_F(SourceBufferStreamTest, SetExplicitDuration_UpdateSelectedRange) { + // Seek to start of stream. + SeekToTimestamp(base::TimeDelta::FromMilliseconds(0)); + + NewSegmentAppend("0K 30 60 90"); + + // Read out the first few buffers. + CheckExpectedBuffers("0K 30"); + + // Set duration to be right before buffer 1. + stream_->OnSetDuration(base::TimeDelta::FromMilliseconds(60)); + + // Verify that there is no next buffer. + CheckNoNextBuffer(); + + // We should be able to append new buffers at this point. + NewSegmentAppend("120K 150"); + + CheckExpectedRangesByTimestamp("{ [0,60) [120,180) }"); +} + // Test the case were the current playback position is at the end of the // buffered data and several overlaps occur that causes the selected // range to get split and then merged back into a single range. |