]> git.sesse.net Git - ffmpeg/commit
cuvid: Implement flush to support seeking in media players
authorPhilip Langdale <philipl@overt.org>
Sun, 4 Sep 2016 16:47:29 +0000 (09:47 -0700)
committerTimo Rothenpieler <timo@rothenpieler.org>
Tue, 6 Sep 2016 19:52:05 +0000 (21:52 +0200)
commit86910b15c9ee2d5c377b137ec653c044572f94ff
tree08f2113db51bff5dd94e6b7b7330f057e5d9a1c6
parent1891dfe0130991ee138d01f2877678de717b9e23
cuvid: Implement flush to support seeking in media players

Right now, if we attempt to use cuvid in a media player and then
try to seek, the decoder will happily pass out whatever frames were
already in flight before the seek.

There is both the output queue in our code and some number of frames
within the cuvid decoder that need to be accounted for.

cuvid doesn't support flush, so our only choice is to do a brute-force
re-creation of the decoder, which also implies re-creating the parser,
but this is fine.

The only subtlty is that there is sanity check code in decoder
initialisation that wants to make sure the HWContextFrame hasn't already
been initialised. This is a fair check to do at the beginning but not
after a flush, so it has to be made conditional.

Signed-off-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
libavcodec/cuvid.c
libavcodec/version.h