Commit Graph

25 Commits

Author SHA1 Message Date
trav90 f07e44834a Update code comment 2018-07-25 06:24:50 +08:00
trav90 44558c1af2 [ffmpeg] Request YUVJ420P format explicitly
Requesting YUV420P can cause crashes with some versions of FFmpeg.
2018-07-25 06:24:48 +08:00
trav90 b9ab7404d4 [ffmpeg] Add support for YUV444P pixel format in FFmpeg
We also prefer YUV444 format when the decoder supports it.
2018-07-25 06:24:45 +08:00
trav90 5a4f0a6ba5 Don't use all CPUs available when decoding with FFmpeg 2018-07-25 06:24:39 +08:00
trav90 7666710f2a Do not create extra threads when decoding small videos with FFmpeg
Instead we use our current decoding's taskqueue.
2018-07-25 06:24:38 +08:00
trav90 f96e952e66 Don't use libav to decode VP9 2018-07-25 06:24:24 +08:00
trav90 1258bc5bfe Add support for libavcodec 57
At this point only the original FFmpeg project is supported.
2018-07-25 06:24:04 +08:00
trav90 5031c1f157 Reduce threads used in FFmpeg video decoder
FFmpeg PDM currently uses as many cores (virtual or otherwise) as available *per* decoder. This means on a typical quad-core machine (for example), that's 8 threads per video.

This reduces the number of threads FFmpeg uses using the same logic as what is used by libvpx to ensure that we won't get a regression due to excessive memory/thread use.
2018-07-25 06:22:43 +08:00
trav90 95a8f149db Have specialized AVCodecContext initialization
A common initialization procedure is too restrictive, and we end up setting up audio configuration for video decoding and vice-versa.
2018-07-25 06:22:41 +08:00
trav90 4d1ef4248d Let FFmpeg manage its own memory allocation
The API to override memory allocation was deprecated years ago and was completely removed in libavcodec 57.
2018-07-25 06:22:39 +08:00
trav90 6f315285f9 Fix VP9 decoding with recent version of libav.
Recent libav do not require a codec parser to decode VP9.
2018-07-25 06:21:46 +08:00
trav90 ea47e5bd62 Disable ffvpx with libav0.8 and earlier 2018-07-25 06:21:44 +08:00
trav90 023bd79e39 Allow VP8/VP9 decoding via FFmpeg 2018-07-25 06:21:42 +08:00
trav90 eb5ceada68 Parse raw data to identify single frames before decoding
A VP9 or VP9 packet may contains alternate frames. They need to be fed separately to the FFmpeg decoder.
2018-07-25 06:21:40 +08:00
trav90 bfafa7aaa9 Properly assign the decoded sample duration
We default to the previous logic if for some unlikely condition we couldn't find the frame's duration (using the last input frame's duration).
2018-07-25 06:21:14 +08:00
trav90 0ab9d0b05a Properly set the keyframe flag
We were incorrectly setting the keyframe flag of the last input sample rather than of the decoded one.
2018-07-25 06:21:12 +08:00
trav90 0a7eb3d9c0 Use LibAV/FFmpeg logic to detect invalid pts
The logic was extracted from LibAV cmdutils.c. FFmpeg provides an API for that (av_frame_get_best_effort_timestamp()) unfortunately this isn't provided by LibAV.
So copy the logic instead in order to keep compatibility with the two forks.
2018-07-25 06:21:09 +08:00
trav90 61c7b38e08 Fix pts calculation in FFmpeg video decoder 2018-07-25 06:21:08 +08:00
trav90 8b514b3576 Revert "Use demuxed dimensions to determine picture size and offset"
Causes build bustage. Also doesn't apply to H.264 video (which is currently our only use for FFmpeg).
2018-07-25 06:20:33 +08:00
trav90 c09f5b9f68 Use demuxed dimensions to determine picture size and offset
Don't assume it always has an offset of (0,0)
2018-07-25 06:20:23 +08:00
trav90 b20af88870 Work around bug in some versions of LibAV
When multi-threading decoding is enabled; the frames dimensions were incorrectly set with some versions of LibAV.
2018-07-25 01:31:40 +08:00
trav90 8492676d0d Fix image alignment allocation 2018-07-25 01:31:36 +08:00
trav90 2c5c4a6d69 Fix pts calculations in older LibAV versions 2018-07-25 01:31:34 +08:00
trav90 9a6b3eb6b1 Use getter to access MediaRawData mData and mSize member 2018-07-25 01:31:17 +08:00
trav90 538539f5c3 Move PlatformDecoderModule outside fmp4 2018-07-25 01:29:11 +08:00