Skip to content

video_output: reset clock on display error

The member sys->clock is assigned from the vout_Request to the decoder clock, and was assigned back to NULL when the vout was stopped.

However, when the decoder_UpdateVideoOutput call would fail because of the display, the clock would have been assigned to the video output and vout_Stop would never be called since the vout was never started, leading to the sys->clock member being unexpectedly non-null when starting the video output.

  • 1/ Creation of the first decoder.
  • 2/ Decoder_UpdateVideoOutput() is called from the decoder.
  • 3/ Calling input_resource_RequestVout with first decoder clock.
  • 4/ Display fails to open, but sys->clock is now non-null.
  • 5/ Close of the first ES / decoder, sys->clock is destroyed.
  • 6/ Creation of a second decoder.
  • 7/ Decoder_UpdateVideoOutput() is called from the second decoder.
  • 8/ Calling input_resource_RequestVout with the second decoder clock.
  • 9/ If the window synchronously reports a size, then the previous released clock is used and it crashes.

The clock must either be NULL when failing to open the vout or assigned before the window is started.

Having the clock being NULL when enabling the window is handy because it won't trigger an interrupt of the clock for nothing, but also the additional lock will still happen only on error, when no other client is using the clock lock anyway.

Indirect regression from 316fb563.

Fixes #27756 (closed)

Merge request reports