Skip to content

Commit

Permalink
Doesn't check anymore whether the duration of input and output file a…
Browse files Browse the repository at this point in the history
…re the same.

Check only if the output duration is bigger than 0
  • Loading branch information
vivien committed Jul 2, 2010
1 parent 8314eeb commit 7e3d92e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/rvideo/transcoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions spec/units/transcoder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7e3d92e

Please sign in to comment.