diff options
author | George Claghorn <george@basecamp.com> | 2018-01-20 14:47:04 -0500 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2018-01-20 14:47:09 -0500 |
commit | cf1c48478d1f48d763c3bee92d6bc6cfb3e63dba (patch) | |
tree | 54a1baae7ad146af9fc9d48c7c88a8f7efc0c025 /activestorage/lib/active_storage | |
parent | 9bf41f249535cf333ca006490def702c1c89cc88 (diff) | |
download | rails-cf1c48478d1f48d763c3bee92d6bc6cfb3e63dba.tar.gz rails-cf1c48478d1f48d763c3bee92d6bc6cfb3e63dba.tar.bz2 rails-cf1c48478d1f48d763c3bee92d6bc6cfb3e63dba.zip |
Cope with videos with undefined display aspect ratios
Diffstat (limited to 'activestorage/lib/active_storage')
-rw-r--r-- | activestorage/lib/active_storage/analyzer/video_analyzer.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activestorage/lib/active_storage/analyzer/video_analyzer.rb b/activestorage/lib/active_storage/analyzer/video_analyzer.rb index f0d9baa199..656e362187 100644 --- a/activestorage/lib/active_storage/analyzer/video_analyzer.rb +++ b/activestorage/lib/active_storage/analyzer/video_analyzer.rb @@ -55,8 +55,12 @@ module ActiveStorage def display_aspect_ratio if descriptor = video_stream["display_aspect_ratio"] - terms = descriptor.split(":", 2).collect(&:to_i) - terms if terms.count == 2 && terms.min >= 0 + if terms = descriptor.split(":", 2) + numerator = Integer(terms[0]) + denominator = Integer(terms[1]) + + [numerator, denominator] unless numerator == 0 + end end end |