From 5ad7e8c09e49ce439acd97ca367d650df5c1de46 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 2 Nov 2019 19:53:32 +0000 Subject: player: automatically pause if last sink dies Attempting to play (and fail) every song in the queue or tracklist is not ideal when a the USB/HDMI cable to the sound device gets unplugged by accident. When tee-ing to multiple sinks, we will still gracefully continue if one goes dead and there are remaining sinks. Suggested-by: Rene Maurer Link: https://80x24.org/dtas-all/874l0kb9qm.fsf@loco10.cumparsita.ch/ --- lib/dtas/player.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb index 37f2c96..61d29d2 100644 --- a/lib/dtas/player.rb +++ b/lib/dtas/player.rb @@ -282,7 +282,7 @@ class DTAS::Player # :nodoc: if deleted[0] warn("#{sink.name} died unexpectedly: #{status.inspect}") deleted.each { |t| drop_target(t) } - __current_drop unless @targets[0] + do_pause unless @targets[0] return # sink stays dead if it died unexpectedly end @@ -451,7 +451,7 @@ class DTAS::Player # :nodoc: # pull data from sink_buf into @targets, source feeds into sink_buf def sink_iter wait_iter = broadcast_iter(@sink_buf, @targets) - __current_drop if nil == wait_iter # sink error, stop source + do_pause if nil == wait_iter # sink error, stop source return wait_iter if @current # no source left to feed sink_buf, drain the remaining data -- cgit v1.2.3-24-ge0c7