[mpg123-devel] [ mpg123-Bugs-3393801 ] after each about 26h I got code 18
Brought to you by:
sobukus
From: SourceForge.net <no...@so...> - 2011-08-24 15:50:39
|
Bugs item #3393801, was opened at 2011-08-18 13:01 Message generated for change (Comment added) made by nopsoft You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=733194&aid=3393801&group_id=135704 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: mpglib Group: 1.13.3 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Janusz Uzycki (nopsoft) Assigned to: Nobody/Anonymous (nobody) Summary: after each about 26h I got code 18 Initial Comment: (DVB) MPEG2-TS stream audio (MPEG1 Layer II) decoding: dumprtp | ts2es -stdin -stdout -pid 403 | mpg123 --stdout --resync-limit -1 - > /dev/null after about 26 hours (tested by 2 weeks - several attempts) I got: [...] ### Error reading TS packet in ts_extract_pid_packet ### Error reading TS packet in ts_extract_pid_packet Note: Illegal Audio-MPEG-Header 0x4b60d817 at offset 2152598041. Note: Trying to resync... Note: Skipped 432 bytes in input. [mpg123.c:665] error: ...in decoding next frame: Error reading the stream. (code 18) It seems it is caused by frame errors (part of TS frames is lost -> MPEG1 frames are cutted) and resync-ing. However the error 18 happens also when resync-limit is set below 0. Any ideas? ---------------------------------------------------------------------- >Comment By: Janusz Uzycki (nopsoft) Date: 2011-08-24 17:50 Message: It is interesting that sizeof(off_t) = 8, and: checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... 64 checking for size_t... yes checking for uintptr_t... yes checking for ssize_t... yes checking for off_t... yes checking for int32_t... yes checking for uint32_t... yes checking for int16_t... yes checking for uint16_t... yes checking size of size_t... 4 checking size of ssize_t... 4 checking size of off_t... 8 checking size of int32_t... 4 checking size of long... 4 checking if we want to enable alias wrappers for largefile... yes I will try to combine: https://sourceforge.net/tracker/index.php?func=detail&aid=3314817&group_id=135704&atid=733194 and http://www.suse.de/~aj/linux_lfs.html ---------------------------------------------------------------------- Comment By: Janusz Uzycki (nopsoft) Date: 2011-08-24 17:27 Message: You are right. Circular math will break file seeking. off_t as 64bit seems good workaround. The default configure: CPU Optimization ........ x86 Compiler Optimization ... 2 Gapless Support ......... enabled Debugging ............... disabled Seek table size ......... 1000 FIFO support ............ enabled Buffer .................. enabled Network (http streams) .. enabled Network Sockets ......... Posix IPv6 (getaddrinfo) ...... enabled File offsets ............ default LFS alias symbols ....... enabled (32) Alignment checks ........ Core libmpg123 features: Integer conversion ...... fast Layer I ................. enabled Layer II ................ enabled Layer III ............... enabled NtoM resampling ......... enabled downsampled decoding .... enabled Feeder/buffered input ... enabled ID3v2 parsing ........... enabled String API .............. enabled ICY parsing/conversion .. enabled Error/warning messages .. enabled Win32 Unicode File Open.. unneeded Feature Report Function.. enabled Output formats (nofpu will disable all but 16 or 8 bit!): 8 bit integer ........... enabled 16 bit integer .......... enabled 32/24 bit integer ....... enabled real (32 bit float) ..... enabled I will try to switch off_t into 64bit under 32bit system. ---------------------------------------------------------------------- Comment By: Thomas Orgis (sobukus) Date: 2011-08-23 08:08 Message: Oh, I did wonder if there is trouble lurking with endless streaming. When you add logic to help working with finite files (like exact seeking, gapless decoding), you run into danger affecting basic dumb functionality. Well, I did. That stuff is too intertwangled and I'd like a sabbatical to clean it up properly... but, well. It's not wish-time now. Without spotting the peculiar value of offset just before final breakage, I'd have taken my sweet time to reproduce your issue: On a system with 64 bit off_t your 26 hours until overflow extend for 12 million years or so. I have to think about the proper overflow handling ... I tend towards making basic decoding independent of position tracking. If mpg123 cannot recall what position it is in in the stream, so be it. One could catch overflow and just mark stream position invalid ... seeking apart from small scratch buffer is disabled anyway. The quick hack would be to check if file position would overflow before incrementing and just ensuring that it stays positive. I don't see a point in pretending a stream position with circular math when it is clearly not valid anymore. But apart from that: Do you have largefile support disabled on purpose? ---------------------------------------------------------------------- Comment By: Janusz Uzycki (nopsoft) Date: 2011-08-21 00:13 Message: Nice to see so fast reply - thanks. However apart from such work I wish you a nice weekend:) ---------------------------------------------------------------------- Comment By: Thomas Orgis (sobukus) Date: 2011-08-18 20:07 Message: Thanks for your elaborate investigation and most importantly the submitting of test data. I'll digest this over the weekend and I am quite confident that we can come up with a fix. ---------------------------------------------------------------------- Comment By: Janusz Uzycki (nopsoft) Date: 2011-08-18 18:51 Message: I've noticed that probably fr->rd->tell() returns negative value (off_t) in parse.c tell() is declared in readers.c as generic_tell() Do you happen to know consequences of introduction circular filepos in libmpg123? I can deliver the math for eg.31/32bits: /**************************************************************************/ /* cyclic offset counting */ /* maximum 32-bit offset value without a sign */ /*#define HOFFSET_MAX 0x7FFFFFFFL*/ #define HOFFSET_MAX 0x7FFFFFFF/*UL/L causes: warning: format ‘%u’ expects type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ */ /* distance a from b, condition: cyclic "a >= b", a is newer than b... (for forward counting assumption) */ #define HOFFSET_DIST_ba(a, b) ( ( (a) - (b) ) & HOFFSET_MAX ) #define min(a, b) ( a < b ? a : b ) /*#define max(a, b) ( a > b ? a : b )*/ /* the lowest circular distance between a and b */ #define HOFFSET_DIST(a, b) min(HOFFSET_DIST_ba(a, b), HOFFSET_DIST_ba(b, a)) /* check if circular "a >= b", ie. a is newer than b, or a = b (equal), or a = b + (HOFFSET_MAX+1)/2 */ #define HOFFSET_a_GE_b(a, b) (HOFFSET_DIST_ba(a, b) <= HOFFSET_DIST_ba(b, a)) /* check if circular "a > b", ie. a is newer than b, and a != b + (HOFFSET_MAX+1)/2 */ #define HOFFSET_a_GT_b(a, b) (HOFFSET_DIST_ba(a, b) < HOFFSET_DIST_ba(b, a)) /**************************************************************************/ best regards Janusz Uzycki ---------------------------------------------------------------------- Comment By: Janusz Uzycki (nopsoft) Date: 2011-08-18 17:20 Message: mpg123 -v gives next surprise. Frame number difference of the succesive frames after resing is not constant (proper value seems to be 32). Is it ok? : Frame# 10688 [ 0], Time: 04:16.51 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6161056. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 10720 [ 0], Time: 04:17.28 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6178914. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 10752 [ 0], Time: 04:18.04 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6196772. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 10784 [ 0], Time: 04:18.81 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6214630. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 10816 [ 0], Time: 04:19.58 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6232488. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 10848 [ 0], Time: 04:20.35 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6250346. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 10880 [ 0], Time: 04:21.12 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6268204. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 10904 [ 0], Time: 04:21.69 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6286062. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 10936 [ 0], Time: 04:22.46 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6303920. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 10968 [ 0], Time: 04:23.23 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6321778. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 11000 [ 0], Time: 04:24.00 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6339636. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 11032 [ 0], Time: 04:24.76 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6357494. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 11048 [ 0], Time: 04:25.15 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6375352. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 11096 [ 0], Time: 04:26.30 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6393210. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 11128 [ 0], Time: 04:27.07 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6411068. Note: Trying to resync... Note: Skipped 2 bytes in input. Frame# 11152 [ 0], Time: 04:27.64 [00:00.00], RVA: off, Vol: 100(100)Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 6428926. ---------------------------------------------------------------------- Comment By: Janusz Uzycki (nopsoft) Date: 2011-08-18 17:09 Message: I cut the last 2 bytes of the piece: dd if=a_cut.mp2 of=a_cut2.mp2 bs=1 count=17856 and again try with older 1.12.1 (1.13.3 has exactly the same bug - I've checked also): while [ 1 ]; do cat a_cut2.mp2; done | mpg123 --stdout - >/dev/null High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3 version 1.12.1; written and copyright by Michael Hipp and others free software (LGPL/GPL) without any warranty but with best wishes Playing MPEG stream 1 of 1: - ... MPEG 1.0 layer II, 192 kbit/s, 48000 Hz stereo And here is no resync - the limit problem dissapeared (mpg123 does not finish itself). So the bug must be in resync section. ---------------------------------------------------------------------- Comment By: Janusz Uzycki (nopsoft) Date: 2011-08-18 16:08 Message: I attached short part of the stream (a_cut.mp2) extracted from MPEG2-TS. Now: while [ 1 ]; do cat a_cut.mp2; done | mpg123 --stdout - >/dev/null and after a moment: High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3 version 1.12.1; written and copyright by Michael Hipp and others free software (LGPL/GPL) without any warranty but with best wishes Playing MPEG stream 1 of 1: - ... MPEG 1.0 layer II, 192 kbit/s, 48000 Hz stereo [...] Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 2147353114. Note: Trying to resync... Note: Skipped 2 bytes in input. Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 2147370972. Note: Trying to resync... Note: Skipped 2 bytes in input. Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 2147388830. Note: Trying to resync... Note: Skipped 2 bytes in input. Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 2147406688. Note: Trying to resync... Note: Skipped 2 bytes in input. Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 2147424546. Note: Trying to resync... Note: Skipped 2 bytes in input. Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 2147442404. Note: Trying to resync... Note: Skipped 2 bytes in input. Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 2147460262. Note: Trying to resync... Note: Skipped 2 bytes in input. Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 2147478120. Note: Trying to resync... Note: Skipped 2 bytes in input. Note: Illegal Audio-MPEG-Header 0x1ad0fffc at offset 2147495978. Note: Trying to resync... Note: Skipped 2 bytes in input. [mpg123.c:643] error: ...in decoding next frame: Error reading the stream. (code 18) [1491:08] Decoding of - finished. Is it offset value limit? How to workaround the limit? Is mpg123 able to decode a stream for more than 26 hours? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=733194&aid=3393801&group_id=135704 |