Closed coldays closed 3 months ago
@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.
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
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
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:
ffmpeg -re -i my_test_video.ts -c copy -f mpegts udp://238.255.255.255:1234
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