• wm4's avatar
    pthread_frame: don't return stale error codes after flush · 15a23a83
    wm4 authored
    Consider the following sequence of events:
    
    - open a codec without AV_CODEC_CAP_DELAY
    - decode call fails with an error
    - ff_thread_flush() is called
    - drain packet is sent
    
    Then the last step would make ff_thread_decode_frame() return an error,
    because p->result can still be set to an error value. This is because
    submit_packet returns immediately if AV_CODEC_CAP_DELAY is not set, and
    no worker thread gets the chance to reset p->result, yet its value is
    trusted by ff_thread_decode_frame().
    
    Fix this by clearing the error fields on flush.
    15a23a83
pthread_frame.c 32.2 KB