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

Side by Side Diff: media/filters/ffmpeg_glue.cc

Issue 2497603003: Roll src/third_party/ffmpeg/ 3c7a09882..cdf4accee (3188 commits). (Closed)
Patch Set: Rebase (liberato@'s pipeline_integration_test_base conflicted; using liberato@'s now here) Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/ffmpeg_glue.h" 5 #include "media/filters/ffmpeg_glue.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 191 }
192 192
193 // If avformat_open_input() hasn't been called, we should simply free the 193 // If avformat_open_input() hasn't been called, we should simply free the
194 // AVFormatContext and buffer instead of using avformat_close_input(). 194 // AVFormatContext and buffer instead of using avformat_close_input().
195 if (!open_called_) { 195 if (!open_called_) {
196 avformat_free_context(format_context_); 196 avformat_free_context(format_context_);
197 av_free(avio_context_->buffer); 197 av_free(avio_context_->buffer);
198 return; 198 return;
199 } 199 }
200 200
201 // If avformat_open_input() has been called with this context, we need to 201 // AVCodecContext closing and freeing needs to be done by users of FFmpegGlue
DaleCurtis 2016/11/14 17:58:21 I'd just delete this, no one looking for this info
wolenetz 2016/11/15 02:15:35 Done.
202 // close out any codecs/streams before closing the context. 202 // prior to its destruction. Using ScopedPtrAVFreeContext can help with this.
203 if (format_context_->streams) {
204 for (int i = format_context_->nb_streams - 1; i >= 0; --i) {
205 AVStream* stream = format_context_->streams[i];
206
207 // The conditions for calling avcodec_close():
208 // 1. AVStream is alive.
209 // 2. AVCodecContext in AVStream is alive.
210 // 3. AVCodec in AVCodecContext is alive.
211 //
212 // Closing a codec context without prior avcodec_open2() will result in
213 // a crash in FFmpeg.
214 if (stream && stream->codec && stream->codec->codec) {
215 stream->discard = AVDISCARD_ALL;
216 avcodec_close(stream->codec);
217 }
218 }
219 }
220 203
221 avformat_close_input(&format_context_); 204 avformat_close_input(&format_context_);
222 av_free(avio_context_->buffer); 205 av_free(avio_context_->buffer);
223 } 206 }
224 207
225 } // namespace media 208 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698