Fix freeze YouTube al cambio punteggio: PNG atomica e relay stabile
rsvg scrive su .tmp poi rename; il feeder ignora PNG parziali. YouTube relay: no doppio avvio, reconnect RTMP; overlay restart solo dopo 3 miss. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -16,13 +16,24 @@ trap("TERM") { stop = true }
|
||||
trap("INT") { stop = true }
|
||||
|
||||
# image2pipe richiede frame continui: inviamo la PNG a ritmo fisso ( anche se invariata ).
|
||||
last_bytes = nil
|
||||
File.open(pipe_path, "wb") do |pipe|
|
||||
loop do
|
||||
break if stop
|
||||
|
||||
if File.exist?(png_path)
|
||||
pipe.write(File.binread(png_path))
|
||||
pipe.flush
|
||||
bytes = File.binread(png_path)
|
||||
# Evita frame corrotti durante rsvg-convert (file parziale prima del rename atomico).
|
||||
next if bytes.bytesize < 512
|
||||
|
||||
if bytes != last_bytes
|
||||
pipe.write(bytes)
|
||||
pipe.flush
|
||||
last_bytes = bytes
|
||||
elsif last_bytes
|
||||
pipe.write(last_bytes)
|
||||
pipe.flush
|
||||
end
|
||||
end
|
||||
|
||||
sleep poll_sec
|
||||
|
||||
Reference in New Issue
Block a user