After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 791473 - flacparse/dec: early eos if header indicates file is shorter than it actually is
flacparse/dec: early eos if header indicates file is shorter than it actually is
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.8.3
Other Linux
: Normal major
: 1.12.5
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-12-11 11:55 UTC by Wojtek Bogusz
Modified: 2018-01-17 14:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Audacity sample view of the above flac file (52.29 KB, image/png)
2017-12-18 15:12 UTC, gkrithi8
  Details
flacdec: flush flac decoder on lost sync. (2.28 KB, patch)
2018-01-08 14:25 UTC, Mathieu Duponchelle
committed Details | Review

Description Wojtek Bogusz 2017-12-11 11:55:14 UTC
i have couple audio files which cause rhythmbox to stop playing and skip to next track on the album. i tested those with VLC and they play ok there. i could share offending track with a developer who would like to take a look on this. let me know.
Comment 1 gkrithi8 2017-12-11 16:57:25 UTC
you can probably test the track with gst-play.

http://manpages.ubuntu.com/manpages/xenial/man1/gst-play-1.0.1.html

and see the behavior.
Comment 2 Wojtek Bogusz 2017-12-11 22:58:04 UTC
thanks. so i did with one of the tracks that i remember to skip:

$ gst-play-1.0 /home/wojtek/Music/Johann\ Johannsson/2012\ -\ Free\ the\ Mind/02\ Radio.flac 
Press 'k' to see a list of keyboard shortcuts.
Now playing /home/wojtek/Music/Johann Johannsson/2012 - Free the Mind/02 Radio.flac
Redistribute latency...
0:02:48.4 / 0:03:50.5       
Reached end of play list.

i am sure you see that it reached 2:48.4 and concluded it is end of the play list but the track has length of 3:50.5
Comment 3 Jonathan Matthew 2017-12-18 10:11:36 UTC
What distribution are you using, and what versions of the various gstreamer packages do you have?  Most importantly gst-plugins-good.
Comment 4 Wojtek Bogusz 2017-12-18 10:22:13 UTC
i am on Ubuntu 16.04.3. would this be helpful:

$ dpkg --get-selections | grep -i gstreamer
gir1.2-gstreamer-1.0				install
gstreamer1.0-alsa:amd64				install
gstreamer1.0-clutter-3.0			install
gstreamer1.0-fluendo-mp3:amd64			install
gstreamer1.0-libav:amd64			install
gstreamer1.0-plugins-bad:amd64			install
gstreamer1.0-plugins-bad-faad:amd64		install
gstreamer1.0-plugins-bad-videoparsers:amd64	install
gstreamer1.0-plugins-base:amd64			install
gstreamer1.0-plugins-base-apps			install
gstreamer1.0-plugins-good:amd64			install
gstreamer1.0-plugins-ugly:amd64			install
gstreamer1.0-plugins-ugly-amr:amd64		install
gstreamer1.0-pulseaudio:amd64			install
gstreamer1.0-tools				install
gstreamer1.0-x:amd64				install
libgstreamer-plugins-bad1.0-0:amd64		install
libgstreamer-plugins-base1.0-0:amd64		install
libgstreamer-plugins-good1.0-0:amd64		install
libgstreamer1.0-0:amd64				install
libreoffice-avmedia-backend-gstreamer		install

please let me know what information would be helpful to send you and how do i see it on the system. thanks and be well
Comment 5 Jonathan Matthew 2017-12-18 10:25:35 UTC
Can you provide the exact version numbers of those packages?

Output from 'gst-play-1.0 --gst-debug=*:4 --gst-debug-no-color file.flac' for at least one affected file would certainly help too, assuming this isn't already fixed in newer versions.
Comment 6 Wojtek Bogusz 2017-12-18 13:30:04 UTC
i did:

$ gst-play-1.0 --gst-debug=*:4 --gst-debug-no-color /home/wojtek/Music/Johann\ Johannsson/2012\ -\ Free\ the\ Mind/02\ Radio.flac  &> output.txt

and uploaded outout.txt to https://share.riseup.net/#ZrR8pQFUQSMBj3SLsUhJTg

i also uploaded "02 Radio.flac" to https://share.riseup.net/#cPfox7HC_GzMoL1ZB_ftaw

i hope this helps
Comment 7 gkrithi8 2017-12-18 15:12:16 UTC
Created attachment 365705 [details]
Audacity sample view of the above flac file

The content length of the flac audio is only 2 min 48.484 seconds ( which is in line with #c2 ).
Comment 8 Wojtek Bogusz 2017-12-18 15:40:54 UTC
well.. VLC plays whole 3:50... and 2:48 is not the end of the audio file.
Comment 9 gkrithi8 2017-12-18 16:52:25 UTC
that is correct.

converting the flac to wav file ( ffmpeg -i "02 Radio.flac" "02 Radio.wav" ) and loading in audacity gives length of 3:50.
Comment 10 gkrithi8 2017-12-18 18:16:47 UTC
Relevant lines from 'gst-play-1.0 --gst-debug=*:4 --gst-debug-no-color 02\ Radio.flac':

0:02:47.498260346  6190 0x7fc1c4183280 INFO                 flacdec gstflacdec.c:739:gst_flac_dec_flush:<flacdec0> draining, 5924360 bytes left in adapter
0:02:47.498305066  6190 0x7fc1c4183280 WARN            audiodecoder gstaudiodecoder.c:1596:gst_audio_decoder_drain:<flacdec0> still 669 frames left after draining
0:02:47.499097615  6190 0x7fc1c4183280 INFO                    task gsttask.c:319:gst_task_func:<flacparse0:sink> Task going to paused

vlc and mplayer, both play fine till 3m 50s.
Comment 11 gkrithi8 2017-12-18 18:54:05 UTC
$ gst-play-1.0 --version
gst-play-1.0 version 1.12.4
GStreamer 1.12.4
http://packages.qa.debian.org/gst-plugins-base1.
Comment 12 gkrithi8 2017-12-28 17:28:43 UTC
libflac seems to be unhappy with the flac file, as below:

$ flac --analyze 02\ Radio.flac 
flac 1.3.2

02 Radio.flac: *** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC

02 Radio.flac: ERROR while decoding data
               state = FLAC__STREAM_DECODER_ABORTED

So, this could be a case of "make flac file play through errors" bug for gstreamer.
Comment 13 gkrithi8 2017-12-29 10:23:52 UTC
mplayer, gst-playbin, vlc all use libFLAC.

1. mplayer handles packets past EOF, so it continues to play as long as possible.

[flac @ 0x7fd71466c920]Got unexpected packet after EOF
A: 168.3 (02:48.3) of 230.0 (03:50.0)  0.7% 
[flac @ 0x7fd71466c920]Got unexpected packet after EOF
A: 168.5 (02:48.5) of 230.0 (03:50.0)  0.7% 

2. vlc seems to handle it too. There is a minor 0.5 second glitch at 2m:48s, with the following log

[0000556c7735eb80] main audio output warning: playback way too early (-186201): playing silence
[0000556c7735eb80] main audio output debug: inserting 8211 zeroes

past which it continues to play

So, gstreamer "flacdec" plugin can probably handle this special case, and let the file play as long as possible.
Comment 14 Tim-Philipp Müller 2018-01-01 21:29:07 UTC
A sample file would be helpful indeed.
Comment 15 Wojtek Bogusz 2018-01-02 21:41:34 UTC
Tim-Philipp here you are same file again: 
https://share.riseup.net/#CQ0rKTXJRsNDP7iyhAZMPw
Comment 16 Tim-Philipp Müller 2018-01-02 22:11:53 UTC
Sorry, I missed that earlier, I thought it was both links to a log file.
Comment 17 Mathieu Duponchelle 2018-01-08 14:25:09 UTC
Created attachment 366493 [details] [review]
flacdec: flush flac decoder on lost sync.

This to allow the decoder to start searching for a new
frame again.
Comment 18 Mathieu Duponchelle 2018-01-08 14:27:16 UTC
With the attached patch, file plays back for the whole duration, with a minor glitch around 02:48 as well.
Comment 19 Tim-Philipp Müller 2018-01-08 16:20:19 UTC
Comment on attachment 366493 [details] [review]
flacdec: flush flac decoder on lost sync.

We can't do the decoder flush directly in the callback?
Comment 21 Mathieu Duponchelle 2018-01-11 14:13:54 UTC
Attachment 366493 [details] pushed as 34abfbf - flacdec: flush flac decoder on lost sync.