mpv/video
wm4 33e5755c23 video, audio: always read all frames before getting next packet
The old code tried to make sure at all times to try to read a new
packet. Only once that was read, it tried to retrieve new video or audio
frames the decoder might already have decoded.

Change this to strictly read frames from the decoder until it signals
that it wants a new packet, and only then read and feed a new packet.
This is in theory nicer, follows the libavcodec recommended data flow,
and and reduces the minimum latency by 1 frame.

This merely requires switching the order in which those calls are done.
Normally, the decoder will return only 1 frame until a new packet is
required. If we would just feed it 1 packet, return DATA_AGAIN, and wait
until the next frame is decoded, we would run the playloop 1 time too
often for no reason (which is fine but might have some overhead). To
avoid this, try to read a frame again after possibly feeding a packet.
For this reason, move the feed/read code to its own functions each,
instead of merely moving the code.

The audio and video code for this particular thing is basically
duplicated. The idea is to unify them one day, so make the change to
both. (Doing this for video is the real motivation for this change, see
below.)

The video code change is slightly more complicated, because we have to
care about the framedrop counting (which is just a heuristic, but for
now considered better than nothing, and possibly considered required to
warn the user of framedrops happening - maybe).

Apparently this change helps with stalling streams on Android with the
mediacodec wrapper and mpeg2 decoder implementations which deinterlace on
decoding (and return 2 frames per packet).

Based on an idea and observations by tmm1.
2018-01-01 23:17:56 -08:00
..
decode video, audio: always read all frames before getting next packet 2018-01-01 23:17:56 -08:00
filter vf_vdpaupp: fix error handling and software input mode 2017-12-27 01:52:09 -07:00
out vo_gpu/android: fallback to EGL_WIDTH/HEIGHT 2018-01-01 22:21:44 -08:00
csputils.c csputils: Add support for Display P3 primaries 2017-12-14 23:31:09 +02:00
csputils.h csputils: Add support for Display P3 primaries 2017-12-14 23:31:09 +02:00
d3d.c video: move d3d.c out of decode sub directory 2017-12-01 17:58:56 +01:00
d3d.h video: move d3d.c out of decode sub directory 2017-12-01 17:58:56 +01:00
fmt-conversion.c Add DRM_PRIME Format Handling and Display for RockChip MPP decoders 2017-10-23 21:07:24 +02:00
fmt-conversion.h
hwdec.c video: remove some more hwdec legacy stuff 2017-12-02 04:53:55 +01:00
hwdec.h hwdec: remove unused fields 2017-12-21 19:31:36 +01:00
image_loader.c
image_loader.h
image_writer.c
image_writer.h
img_format.c img_format: remove some guards against old ffmpeg API 2017-11-06 17:14:01 +01:00
img_format.h Add DRM_PRIME Format Handling and Display for RockChip MPP decoders 2017-10-23 21:07:24 +02:00
mp_image.c vd_lavc, mp_image: remove weird mpv specific palette constant 2017-12-01 22:03:38 +01:00
mp_image.h vd_lavc, mp_image: remove weird mpv specific palette constant 2017-12-01 22:03:38 +01:00
mp_image_pool.c video: fix memory leaks with hwdec copy modes 2017-12-01 08:01:41 +01:00
mp_image_pool.h vf_vavpp: use libavutil hw frames API for frame pool and upload 2017-09-29 18:17:51 +02:00
sws_utils.c build: add preliminary LGPL mode 2017-09-21 13:56:27 +02:00
sws_utils.h video: redo video equalizer option handling 2017-08-22 17:01:35 +02:00
vaapi.c hwdec: remove unused fields 2017-12-21 19:31:36 +01:00
vaapi.h video: refactor hw device creation for hwdec copy modes 2017-12-01 08:05:16 +01:00
vdpau.c hwdec: remove unused fields 2017-12-21 19:31:36 +01:00
vdpau.h vd_lavc, vdpau, vaapi: restore emulated API avoidance 2017-12-02 04:53:51 +01:00
vdpau_functions.inc
vdpau_mixer.c video: redo video equalizer option handling 2017-08-22 17:01:35 +02:00
vdpau_mixer.h video: redo video equalizer option handling 2017-08-22 17:01:35 +02:00