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

Side by Side Diff: media/ffmpeg/ffmpeg_common.cc

Issue 7203002: Adding ChunkDemuxer implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cleanup & commenting 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ffmpeg/ffmpeg_common.h" 5 #include "media/ffmpeg/ffmpeg_common.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 else 199 else
200 aspect_ratio = 1.0; 200 aspect_ratio = 1.0;
201 201
202 int width = floor(stream->codec->coded_width * aspect_ratio + 0.5); 202 int width = floor(stream->codec->coded_width * aspect_ratio + 0.5);
203 203
204 // An even width makes things easier for YV12 and appears to be the behavior 204 // An even width makes things easier for YV12 and appears to be the behavior
205 // expected by WebKit layout tests. 205 // expected by WebKit layout tests.
206 return width & ~1; 206 return width & ~1;
207 } 207 }
208 208
209 void DestroyAVFormatContext(AVFormatContext* format_context) {
210 if (!format_context)
scherkus (not reviewing) 2011/06/22 17:31:09 we expect to receive NULL?
acolwell GONE FROM CHROMIUM 2011/06/23 16:51:28 No. I just copied a little too much from FFmpegDem
211 return;
212
213 // Iterate each stream and destroy each one of them.
214 int streams = format_context->nb_streams;
215 for (int i = 0; i < streams; ++i) {
216 AVStream* stream = format_context->streams[i];
217
218 // The conditions for calling avcodec_close():
219 // 1. AVStream is alive.
220 // 2. AVCodecContext in AVStream is alive.
221 // 3. AVCodec in AVCodecContext is alive.
222 // Notice that closing a codec context without prior avcodec_open() will
223 // result in a crash in FFmpeg.
224 if (stream && stream->codec && stream->codec->codec) {
225 stream->discard = AVDISCARD_ALL;
226 avcodec_close(stream->codec);
227 }
228 }
229
230 // Then finally cleanup the format context.
231 av_close_input_file(format_context);
232 }
233
209 } // namespace media 234 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698