summaryrefslogtreecommitdiffstats
path: root/media/webm
diff options
context:
space:
mode:
authoracolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 17:09:07 +0000
committeracolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 17:09:07 +0000
commitc0c884d90bb929d6719d650836d27b6e244b0f92 (patch)
tree434f629642b157d82ac2fb450812009822739659 /media/webm
parent3c627ff7833fbc8114c84f32fcd090e5dc04cc91 (diff)
downloadchromium_src-c0c884d90bb929d6719d650836d27b6e244b0f92.zip
chromium_src-c0c884d90bb929d6719d650836d27b6e244b0f92.tar.gz
chromium_src-c0c884d90bb929d6719d650836d27b6e244b0f92.tar.bz2
Fix ChunkDemuxer crash & parse errors on audio-only or video-only content.
BUG=111128 TEST=ChunkDemuxerTest.TestParseErrorDuringInit, ChunkDemuxerTest.TestAudioOnlyWebMFile, ChunkDemuxerTest.TestVideoOnlyWebMFile Review URL: https://chromiumcodereview.appspot.com/9271042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119461 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/webm')
-rw-r--r--media/webm/webm_stream_parser.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/media/webm/webm_stream_parser.cc b/media/webm/webm_stream_parser.cc
index 26decfc8..f1d6001 100644
--- a/media/webm/webm_stream_parser.cc
+++ b/media/webm/webm_stream_parser.cc
@@ -305,6 +305,7 @@ int WebMStreamParser::ParseInfoAndTracks(const uint8* data, int size) {
ChangeState(PARSING_CLUSTERS);
init_cb_.Run(true, duration);
+ init_cb_.Reset();
return bytes_parsed;
}
@@ -334,14 +335,15 @@ int WebMStreamParser::ParseCluster(const uint8* data, int size) {
if (bytes_parsed <= 0)
return bytes_parsed;
- if (cluster_parser_->audio_buffers().empty() &&
- cluster_parser_->video_buffers().empty())
- return bytes_parsed;
+ const StreamParserHost::BufferQueue& audio_buffers =
+ cluster_parser_->audio_buffers();
+ const StreamParserHost::BufferQueue& video_buffers =
+ cluster_parser_->video_buffers();
- if (!host_->OnAudioBuffers(cluster_parser_->audio_buffers()))
+ if (!audio_buffers.empty() && !host_->OnAudioBuffers(audio_buffers))
return -1;
- if (!host_->OnVideoBuffers(cluster_parser_->video_buffers()))
+ if (!video_buffers.empty() && !host_->OnVideoBuffers(video_buffers))
return -1;
return bytes_parsed;