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

Roman S. (JIRA) noreply at issues.asterisk.org
Fri Jan 25 08:56:58 CST 2013


Roman S. created ASTERISK-20984:
-----------------------------------

             Summary: Audible clicks when playing sox encoded au file with STREAM FILE AGI command
                 Key: ASTERISK-20984
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-20984
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Formats/format_pcm
    Affects Versions: 1.8.20.0, SVN
            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:

> 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'

> 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  ~.~.....~.......

formats/format_pcm.c

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;

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

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

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

399         off_t min = AU_HEADER_SIZE, max, cur;

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

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

Issue is reproduced with AGI STREAM FILE command because of:

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);

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