[asterisk-bugs] [JIRA] (ASTERISK-21000) Audible clicks when playing sox encoded au file with STREAM FILE AGI command

Rusty Newton (JIRA) noreply at issues.asterisk.org
Sun Jan 27 19:44:59 CST 2013


Rusty Newton created ASTERISK-21000:
---------------------------------------

             Summary: Audible clicks when playing sox encoded au file with STREAM FILE AGI command
                 Key: ASTERISK-21000
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-21000
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Formats/format_pcm
    Affects Versions: SVN, 1.8.20.0
            Reporter: Roman S.
            Severity: Trivial


This is duplicate of ASTERISK-12703 (which is closed, but doesn't solve described issue fully). Initial issue is reproduced with STREAM FILE AGI command and sox encoded au file.

Detailed description:
{noformat}
> soxi no.au 

Input File     : 'no.au'
Channels       : 1
Sample Rate    : 8000
Precision      : 14-bit
Duration       : 00:00:00.60 = 4831 samples ~ 45.2906 CDDA sectors
File Size      : 4.88k
Bit Rate       : 64.6k
Sample Encoding: 8-bit u-law
Comment        : 'Processed by SoX'
{noformat}

{noformat}
> xxd no.au  | head -n 5
0000000: 2e73 6e64 0000 002c 0000 12df 0000 0001  .snd...,........
0000010: 0000 1f40 0000 0001 5072 6f63 6573 7365  ... at ....Processe
0000020: 6420 6279 2053 6f58 0000 0000 ffff ff7e  d by SoX.......~
0000030: feff ffff ff7e 7e7e ffff ffff ffff ffff  .....~~~........
0000040: 7efe 7eff ffff fffe 7eff ffff ffff ffff  ~.~.....~.......
{noformat}


formats/format_pcm.c
{noformat}
282 static int check_header(FILE *f)

300         hdr_size = ltohl(header[AU_HDR_HDR_SIZE_OFF]);
301         if (hdr_size < AU_HEADER_SIZE) {
302                 hdr_size = AU_HEADER_SIZE;
{noformat}

Header size can be larger then default AU_HEADER_SIZE (24 bytes). For mentioned no.au it's 44:

{noformat}
300             hdr_size = ltohl(header[AU_HDR_HDR_SIZE_OFF]);
(gdb)
301             if (hdr_size < AU_HEADER_SIZE) {
(gdb) p hdr_size
$6 = 44
{noformat}

But au_seek() disregarding determined in check_header() value uses default size (AU_HEADER_SIZE = 24).

{noformat}
399         off_t min = AU_HEADER_SIZE, max, cur;

422         if (whence == SEEK_SET)
423                 offset = bytes + min;
{noformat}

This causes audible clicks at the beginning of each such .au file.

Issue is reproduced with AGI STREAM FILE command because of:

{noformat}
1933 static int handle_streamfile(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])

1959         ast_seekstream(fs, 0, SEEK_END);
1960         max_length = ast_tellstream(fs);
1961         ast_seekstream(fs, sample_offset, SEEK_SET);
{noformat}

Playback app. doesn't have such clicks because of direct file seeking - pos = ftello() -> fseeko(END) -> ftello() -> fseeko(pos) - file pointer returns to the same file position (44 instead of 24).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list