Flyleaf icon indicating copy to clipboard operation
Flyleaf copied to clipboard

Fix video changing on network stream not updating player to correct width/height

Open coldays opened this issue 1 year ago • 3 comments

When playing network streams, if the video changes the player does not update width/height. This change checks when receiving frame from decoder if width or height has changed.

How to test:

  1. Start a network stream, e.g.: ffmpeg -re -i my_test_video.ts -c copy -f mpegts udp://238.255.255.255:1234
  2. Start playback with the url
  3. After the player has started playing run taskkill -f -im ffmpeg.exe && ffmpeg -re -i my_other_test_video.ts -c copy -f mpegts udp://238.255.255.255:1234 This assumes the two videos has different resolutions

coldays avatar Mar 08 '24 08:03 coldays

@coldays Can you confirm that this is only for software decoding until I will review this in detail? If I remember right, that was working already for hardware decoding.

SuRGeoNix avatar Mar 08 '24 09:03 SuRGeoNix

Looks like to me that only happens in VideoDecoder.get_format when constructing it. I assume in between playing different files/streams This proposed change checks decoded frames while playing. It does not reconstruct hw frame, but maybe it should

coldays avatar Mar 08 '24 11:03 coldays

Alternatively we can listen to the return value of avcodec_send_packet. If it returns AVERROR_INPUT_CHANGED, we need to set up the decoder/demuxer again. This might be more robust

coldays avatar Mar 08 '24 11:03 coldays