about summary refs log tree commit homepage
path: root/lib/dtas
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-08-27 20:03:24 +0000
committerEric Wong <normalperson@yhbt.net>2013-08-27 20:03:24 +0000
commit3f8e20d745a8163bd9b199e0047bf98a952ed092 (patch)
tree9232b108abce83138aa17a2c6fb12064df716b0c /lib/dtas
parentddcd67c03e17dfcd0e584b5a3a2bfc56da0cac12 (diff)
downloaddtas-3f8e20d745a8163bd9b199e0047bf98a952ed092.tar.gz
It's possible to get zero samples when playing streams of
unknown length (e.g. over Icecast over HTTP)
Diffstat (limited to 'lib/dtas')
-rw-r--r--lib/dtas/source/av_ff_common.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/dtas/source/av_ff_common.rb b/lib/dtas/source/av_ff_common.rb
index 1d0f146..36919e6 100644
--- a/lib/dtas/source/av_ff_common.rb
+++ b/lib/dtas/source/av_ff_common.rb
@@ -118,6 +118,8 @@ module DTAS::Source::AvFfCommon # :nodoc:
   # file itself, not the decoded output
   def samples
     @samples ||= (@duration * @format.rate).round
+  rescue
+    0
   end
 
   def to_hsh