Index: media/filters/ffmpeg_demuxer.cc |
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc |
index 0ee711fd546ce61954585effb15be903ae25d7aa..58082b10e80f9a3957ed46fe977ea40b61866f84 100644 |
--- a/media/filters/ffmpeg_demuxer.cc |
+++ b/media/filters/ffmpeg_demuxer.cc |
@@ -280,25 +280,7 @@ FFmpegDemuxer::~FFmpegDemuxer() { |
if (!format_context_) |
return; |
- // Iterate each stream and destroy each one of them. |
- int streams = format_context_->nb_streams; |
- for (int i = 0; i < streams; ++i) { |
- AVStream* stream = format_context_->streams[i]; |
- |
- // The conditions for calling avcodec_close(): |
- // 1. AVStream is alive. |
- // 2. AVCodecContext in AVStream is alive. |
- // 3. AVCodec in AVCodecContext is alive. |
- // Notice that closing a codec context without prior avcodec_open() will |
- // result in a crash in FFmpeg. |
- if (stream && stream->codec && stream->codec->codec) { |
- stream->discard = AVDISCARD_ALL; |
- avcodec_close(stream->codec); |
- } |
- } |
- |
- // Then finally cleanup the format context. |
- av_close_input_file(format_context_); |
+ DestroyAVFormatContext(format_context_); |
format_context_ = NULL; |
} |