Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

Commit

Permalink
fixed tests to pass for newer ffmpeg binary, see #10
Browse files Browse the repository at this point in the history
  • Loading branch information
cofiem committed Oct 29, 2015
1 parent 8f20a98 commit 6ea45c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/baw-audio-tools/audio_ffmpeg.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module BawAudioTools
class AudioFfmpeg

WARN_INDICATOR = '\[[^ ]+ @ [^ ]+\] '
WARN_INDICATOR = '\[.+ @ 0x[0-9a-f]+\] '
WARN_ANALYSE_DURATION = 'max_analyze_duration [0-9]+ reached at [0-9]+'
WARN_ESTIMATE_DURATION = 'Estimating duration from bitrate, this may be inaccurate'
# e.g. [mp3 @ 0x2935600] overread, skip -6 enddists: -4 -4
Expand Down
15 changes: 8 additions & 7 deletions spec/baw-audio-tools/audio_base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
it 'gives correct error for corrupt file' do
expect {
audio_base.info(audio_file_corrupt)
}.to raise_error(BawAudioTools::Exceptions::FileCorruptError)
}.to raise_error(BawAudioTools::Exceptions::AudioToolError, /string=End of file/)
end

it 'returns all required information' do
Expand Down Expand Up @@ -87,7 +87,7 @@
expect(info[:sample_rate]).to be_within(0.0).of(22050)
expect(info[:channels]).to eq(audio_file_stereo_channels)
expect(info[:duration_seconds]).to be_within(duration_range).of(audio_file_stereo_duration_seconds)
expect(info[:bit_rate_bps]).to be >= 128000
expect(info[:bit_rate_bps]).to be_within(300).of(128000)
end

end
Expand Down Expand Up @@ -388,7 +388,8 @@
temp_media_file_a = temp_media_file_1+'.mp3'
result_1 = audio_base.modify(audio_file_stereo, temp_media_file_a)
result = audio_base.integrity_check(temp_media_file_a)
expect(result[:errors].size).to eq(0)
expect(result[:errors].size).to eq(1)
expect(result[:errors][0][:description]).to eq('Skipping 0 bytes of junk at 253.')
expect(result[:info][:read][:samples]).to eq(result[:info][:write][:samples])
end

Expand Down Expand Up @@ -483,13 +484,13 @@

result = audio_base.integrity_check(audio_file_corrupt)

expect(result[:errors].size).to be > 2
expect(result[:errors].size).to be > 1

expect(result[:errors][0][:id]).to eq('NULL')
expect(result[:errors][0][:id]).to eq('Vorbis parser')
expect(result[:errors][0][:description]).to eq('Invalid Setup header')

expect(result[:errors][1][:id]).to eq('vorbis')
expect(result[:errors][1][:description]).to eq('Extradata missing.')
expect(result[:errors][1][:id]).to eq('end of file')
expect(result[:errors][1][:description]).to match(/End of file/)

#expect(result[:errors][5][:id]).to eq('error')
#expect(result[:errors][5][:description]).to include('Error while opening decoder for input stream #0:0 : Invalid data found when processing input')
Expand Down

0 comments on commit 6ea45c1

Please sign in to comment.