From 7e3d92e1fa2343192b75d0cc32d6fe5b2ea582bd Mon Sep 17 00:00:00 2001 From: vivien Date: Fri, 2 Jul 2010 12:53:34 +0100 Subject: [PATCH] Doesn't check anymore whether the duration of input and output file are the same. Check only if the output duration is bigger than 0 --- lib/rvideo/transcoder.rb | 4 ++-- spec/units/transcoder_spec.rb | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/rvideo/transcoder.rb b/lib/rvideo/transcoder.rb index 87f7ba4..72b4e33 100644 --- a/lib/rvideo/transcoder.rb +++ b/lib/rvideo/transcoder.rb @@ -120,8 +120,8 @@ def check_integrity precision = 1.1 if processed.invalid? @errors << "Output file invalid" - elsif (processed.duration >= (original.duration * precision) or processed.duration <= (original.duration / precision)) - @errors << "Original file has a duration of #{original.duration}, but processed file has a duration of #{processed.duration}" + elsif processed.duration <= 0 + @errors << "Processed file has a duration of #{processed.duration}" end return @errors.size == 0 end diff --git a/spec/units/transcoder_spec.rb b/spec/units/transcoder_spec.rb index 08bd3a0..3193553 100644 --- a/spec/units/transcoder_spec.rb +++ b/spec/units/transcoder_spec.rb @@ -97,10 +97,9 @@ module RVideo end it "should fail if output duration is more than 10% different than the original" do - @mock_original_file.should_receive(:duration).twice.and_return(10) - @mock_processed_file.should_receive(:duration).twice.and_return(13) + @mock_processed_file.should_receive(:duration).twice.and_return(0) @transcoder.execute(@simple_avi, @options).should be_false - @transcoder.errors.should == ["Original file has a duration of 10, but processed file has a duration of 13"] + @transcoder.errors.should == ["Processed file has a duration of 0"] end it "should fail if the processed file is invalid" do