From c0c884d90bb929d6719d650836d27b6e244b0f92 Mon Sep 17 00:00:00 2001 From: "acolwell@chromium.org" Date: Fri, 27 Jan 2012 17:09:07 +0000 Subject: 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 --- media/webm/webm_stream_parser.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'media/webm') 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; -- cgit v1.1