summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/filters/ffmpeg_demuxer.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index e966c7b..a70a0d5 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -529,7 +529,12 @@ void FFmpegDemuxer::DemuxTask() {
// thread.
DCHECK_GE(packet->stream_index, 0);
DCHECK_LT(packet->stream_index, static_cast<int>(packet_streams_.size()));
- FFmpegDemuxerStream* demuxer_stream = packet_streams_[packet->stream_index];
+ FFmpegDemuxerStream* demuxer_stream = NULL;
+ size_t i = packet->stream_index;
+ // Defend against ffmpeg giving us a bad stream index.
+ if (i < packet_streams_.size()) {
+ demuxer_stream = packet_streams_[i];
+ }
if (demuxer_stream) {
// Queue the packet with the appropriate stream. The stream takes
// ownership of the AVPacket.