dtas-all
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] player: automatically pause if last sink dies


From: Eric Wong
Subject: [PATCH] player: automatically pause if last sink dies
Date: Sat, 2 Nov 2019 21:16:54 +0000

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/address@hidden/
---
 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 @@ def sink_death(sink, status)
     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 @@ def __current_drop(src = @current)
   # 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]