• Philip Langdale's avatar
    cuvid: Implement flush to support seeking in media players · 86910b15
    Philip Langdale authored
    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: 's avatarPhilip Langdale <philipl@overt.org>
    Signed-off-by: 's avatarTimo Rothenpieler <timo@rothenpieler.org>
    86910b15
cuvid.c 23.5 KB