Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: media/ffmpeg/ffmpeg_common.cc

Issue 6993042: ffmpeg chromium glue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: once more new test_expectations.txt Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/mock_ffmpeg.cc ('k') | media/ffmpeg/ffmpeg_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/ffmpeg/ffmpeg_common.cc
===================================================================
--- media/ffmpeg/ffmpeg_common.cc (revision 91170)
+++ media/ffmpeg/ffmpeg_common.cc (working copy)
@@ -210,19 +210,21 @@
DCHECK(format_context);
// 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];
+ if (format_context->streams) {
+ 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);
+ // 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);
+ }
}
}
« no previous file with comments | « media/base/mock_ffmpeg.cc ('k') | media/ffmpeg/ffmpeg_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698