[Home]

Summary:ASTERISK-18739: Endianness Problem with Playback WAV Audio on an Big Endian Proccessor ( format_wav.c)
Reporter:Pawel Pastuszak (pawel)Labels:
Date Opened:2011-10-19 12:30:34Date Closed:2011-11-09 09:29:58.000-0600
Priority:MajorRegression?Yes
Status:Closed/CompleteComponents:Formats/format_wav
Versions:SVN 1.8.5.0 1.8.7.0 1.8.7.1 10.0.0-beta1 10.0.0-beta2 10.0.0-rc1 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Pika WARP V2 AMCC 440FP Processor (Big Endian)Attachments:( 0) format_wav.patch
( 1) format_wav.patch
Description:Found an problem playing back wav file format audio using Asterisk 1.8.7 but using Astersik 1.8.4.4 on an big endian processor.

The error that was being reported was
[Oct 18 21:13:33] WARNING[2990]: format_wav.c:171 check_header: Read failed (block header format)
[Oct 18 21:13:33] WARNING[2990]: file.c:376 fn_wrapper: Unable to open format wav
[Oct 18 21:13:33] WARNING[2990]: file.c:959 ast_streamfile: Unable to open asterisk-recording0 (format 0x4 (ulaw)): No such file or directory
[Oct 18 21:13:33] WARNING[2990]: app_playback.c:475 playback_exec: ast_streamfile failed on DAHDI/1-1 for asterisk-recording0

While Running the following dial plan.
exten => 205,1,Answer
exten => 205,2,Wait(2)
exten => 205,3,Record(asterisk-recording%d:wav)
exten => 205,4,Wait(2)
exten => 205,5,Playback(/var/lib/asterisk/sounds/${RECORDED_FILE})
exten => 205,6,Wait(2)
exten => 205,7,Hangup

The root cause of the problem is that from version 1.8.4.4 to 1.8.7 the format_wav.c file was restructured on how it reads and validates the header. Function check_header now search for the fmt header and calls check_header_fmt to validate the header options but when it calleds it passes the length of header as an argument but before this is coverts that argument to the correct endianness. While in check_header_fmt adjusting the fseek it that the covert header size (hsize) argument and covert's it one more time. Because of the double endianness transformation the error happens, only one is required.

Edit: removed inline patch
Comments:By: Pawel Pastuszak (pawel) 2011-10-19 12:39:54.976-0500

Fix ( patch )

By: Pawel Pastuszak (pawel) 2011-10-25 12:07:34.410-0500

Try 2

By: Matthew Nicholson (mnicholson) 2011-11-09 09:29:50.206-0600

Fixed in 1.8 r344048, 10 344049, and trunk 344050.