diff options
author | dalecurtis@chromium.org <dalecurtis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 21:23:32 +0000 |
---|---|---|
committer | dalecurtis@chromium.org <dalecurtis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 21:23:32 +0000 |
commit | b3d4d8f0c45266ac1b5b46e3baa568348b4233c3 (patch) | |
tree | 0a873d138ba3a4453bb266bd51240f70eb34413b /media/ffmpeg/ffmpeg_common.cc | |
parent | 5bc29a2dabe01f1e2315bcc287f11db10df4144b (diff) | |
download | chromium_src-b3d4d8f0c45266ac1b5b46e3baa568348b4233c3.zip chromium_src-b3d4d8f0c45266ac1b5b46e3baa568348b4233c3.tar.gz chromium_src-b3d4d8f0c45266ac1b5b46e3baa568348b4233c3.tar.bz2 |
Switch to AVIO instead of a custom FFmpeg URLProtocol handler.
FFmpegGlue is a filthy den of sin:
- Singleton.
- Unchecked initialization.
- Mixed signed, unsigned usage.
- Requires custom FFmpeg patches.
- Hacks IO through http://0xDEADBEEF
Switching to AVIO will absolve FFmpegGlue of its sins and has the added bonus
of allowing us to tweak the buffer sizes used for read requests over the wire.
AVIO works through a special AVIOContext created through avio_alloc_context()
which is attached to the AVFormatContext used for demuxing. The AVIO context
is initialized with read and seek methods identical to the existing URLProtocol
structures.
During avformat_open_input() we tell FFmpeg to use our AVIO context by
passing NULL in for the filename parameter. FFmpeg will now redirect all reads
and seeks through our AVIO context.
The new FFmpegGlue also handles all destruction cases which can occur after
an OpenContext(), allowing us to unify the slightly disparate shutdown paths
used by FFmpegDemuxer and AudioFileReader.
BUG=118986, 146529
TEST=unit tests under tooling. layout tests. manual playback pass.
Review URL: https://chromiumcodereview.appspot.com/10912080
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165502 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/ffmpeg/ffmpeg_common.cc')
-rw-r--r-- | media/ffmpeg/ffmpeg_common.cc | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc index 6820066..e487c49 100644 --- a/media/ffmpeg/ffmpeg_common.cc +++ b/media/ffmpeg/ffmpeg_common.cc @@ -413,30 +413,4 @@ PixelFormat VideoFormatToPixelFormat(VideoFrame::Format video_format) { return PIX_FMT_NONE; } -void DestroyAVFormatContext(AVFormatContext* format_context) { - DCHECK(format_context); - - // Iterate each stream and destroy each one of them. - 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_open2() 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. - avformat_close_input(&format_context); -} - } // namespace media |