Bug 302652 - When going from a mp3 track to an ogg track, Amarok stops playing
Summary: When going from a mp3 track to an ogg track, Amarok stops playing
Alias: None
Product: phonon-backend-gstreamer
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 4.6.2
Platform: Ubuntu Linux
: HI major
Target Milestone: 4.7
Assignee: Harald Sitter
: 301325 309095 310261 (view as bug list)
Depends on:
Blocks: 299654
  Show dependency treegraph
Reported: 2012-06-27 16:33 UTC by Mark Fraser
Modified: 2013-11-18 15:59 UTC (History)
18 users (show)

See Also:
Latest Commit:
Version Fixed In:

Debug log, short (18.07 KB, text/x-log)
2012-10-18 16:13 UTC, Dainius Masiliūnas
Debug log, long (184.21 KB, text/x-log)
2012-10-18 16:31 UTC, Dainius Masiliūnas
Debug log, with PHONON_SUBSYSTEM_DEBUG=3 (463.77 KB, text/x-log)
2012-11-19 16:45 UTC, Dainius Masiliūnas

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Fraser 2012-06-27 16:33:13 UTC
If I have an mp3 track followed by an ogg track in my playlist, Amarok will not play the ogg track after the mp3 track has stopped. It works going the other way. This started happening when I upgraded to Kubuntu 12.04 from 11.10.


Amarok Version: 2.5.90
KDE Version: 4.8.90 (4.8.90)
Qt Version: 4.8.1
Phonon Version: 4.6.0
Phonon Backend: GStreamer (4.6.0)
PulseAudio: Yes

Amarok Scripts:
    CopyAllCover 1.5 (stopped)
Amarok Script Console 1.0 (stopped)
Android Amarok2 Remote 0.3 (stopped)
Lyricwiki .2 (stopped)
Free Music Charts 1.6.0 (stopped)
Librivox.org 1.0 (stopped)
Cool Streams 1.0 (stopped)

Amarok Plugins:
    AudioCd Collection  (enabled)
DAAP Collection  (enabled)
MTP Collection  (enabled)
MySQLServer Collection  (enabled)
MySQLe Collection  (enabled)
UPnP Collection  (enabled)
Universal Mass Storage Collection  (enabled)
iPod, iPad & iPhone Collection  (enabled)
Ampache (disabled)
Jamendo  (enabled)
Last.fm  (enabled)
MP3 Music Store  (enabled)
MP3tunes (disabled)
Magnatune Store  (enabled)
Podcast Directory  (enabled)
gpodder.net (disabled)
Local Files & USB Mass Storage Backend  (enabled)
NFS Share Backend  (enabled)
SMB (Windows) Share Backend  (enabled)

Reproducible: Always

Steps to Reproduce:
1.Add an mp3 track followed by an ogg track to the play list.
2.Wait for the mp3 track to finish.
3.The ogg track doesn't start playing.

Expected Results:  
I expected the next track in the play list to start playing.
Comment 1 Myriam Schweingruber 2012-06-28 17:47:18 UTC
Could you please change your phonon-backend to vlc, restart KDE and try again? This is most likely a problem with the phonon backend.
Comment 2 Mark Fraser 2012-06-28 18:42:14 UTC
This only started since upgrading to 12.04 and I was using gstreamer before without any trouble.
Comment 3 Myriam Schweingruber 2012-06-28 19:15:28 UTC
Still, it would be nice if you could test, the gstreamer backend is known to have problems in that regard.
Comment 4 Mark Fraser 2012-07-02 08:20:22 UTC
OK, I've installed phonon-backend-vlc and with it enabled it plays as it did before. Looks like another problem with gstreamer in this release.
Comment 5 Myriam Schweingruber 2012-07-07 23:35:06 UTC
Sadly nothing new in that regard, reassigning.
Comment 6 Myriam Schweingruber 2012-07-12 07:12:51 UTC
*** Bug 301325 has been marked as a duplicate of this bug. ***
Comment 7 Steve Murphy 2012-07-12 19:03:11 UTC
I found installing the phonon-backend-vlc alone wasn't good enough, you had to make it more preferred than the old gstreamer backend in the amarok config. The problem does indeed go away after a reboot.
Comment 8 Mark Fraser 2012-07-18 09:07:00 UTC
Had an update to gstreamer this morning that according to the changelog fixed this bug:
    - "don't discard timestamps when consecutive input buffers have 
       the same ts", should fix playback pausing on mp3 to ogg 
       transitions in rhythmbox (lp: #921071)

I've now changed back to phonon-backend-gstreamer, logged out and after logging back in it seems to have fixed this bug.
Comment 9 Mark Fraser 2012-07-18 10:32:44 UTC
Doesn't look like it is fixed as it just happened again.
Comment 10 Matěj Laitl 2012-07-30 14:07:18 UTC
Git commit e1d2ea6ce3ef61af5dcd4f99db9fb407c95ccb2d by Matěj Laitl.
Committed on 24/07/2012 at 10:59.
Pushed by laitl into branch 'master'.

EngineController: don't do serious work in slotAboutToFinish()

...because slotAboutToFinish() may be called twice (or not at all) per
track by some Phonon backends (hi, vlc) - increase play count rather in
slotNewTrackPlaying() or in slotFinished(). This also needs to change
how m_currentTrack is handled, because slotNewTrackPlaying() needs to
have the old one in m_currentTrack.

Also, PlaylistActions::requestNextTrack() is changed to be a read-only
method that shouldn't change playlist state especially when there is no
next track. PlaylistActions::reflectPlaybackFinished() is introduced to
do the thing and is called from EngineController::slotFinished(), which
is a much better place for it than slotAboutToFinish().

Reporters of CCed bugs, please re-test your bug with this commit
applied, it is possible it has been resolved by this patch.
Related: bug 299890, bug 268892, bug 277197, bug 303580, bug 302240

M  +1    -0    ChangeLog
M  +44   -35   src/EngineController.cpp
M  +17   -16   src/playlist/PlaylistActions.cpp
M  +8    -0    src/playlist/PlaylistActions.h

Comment 11 Alex Elsayed 2012-08-01 01:17:26 UTC
This improves the problem, but it's still present. Previously, it would pause for a long time (I just recently discovered that it resumes about an hour later, skipping several tracks), and now it only pauses for about 10 seconds before continuing normally.

Phonon-gstreamer revision: 58b12a8c7a2870f167ee699b98cd62042c3581a6
Amarok revision: 8a212613c83a97234086f1ea1abaa643578ec745
Comment 12 Alex Elsayed 2012-08-03 10:20:02 UTC
Okay, my previous comment was incorrect. The problem is still present, at the same level of severity as before. However, if you seek to near the end of the mp3 track (the way I did due to impatience), the different behavior I described occurs. Allowing the mp3 to play normally results in the long-duration pause. This may have been the case the whole time, I just didn't run into it.
Comment 13 Dainius Masiliūnas 2012-08-15 19:45:06 UTC
I can confirm this bug in 2.5.0. From my testing, it seems that it's not a bug in GStreamer but a bug in Amarok while interacting with GStreamer, as this bug doesn't happen when playing files through KMPlayer with the Phonon backend or through gst123. So it should be reassigned back to amarok.

I'll also test this with Amarok 2.6 once it hits the repositories.
Comment 14 Matěj Laitl 2012-08-15 20:43:25 UTC
(In reply to comment #13)
> I can confirm this bug in 2.5.0. From my testing, it seems that it's not a
> bug in GStreamer but a bug in Amarok while interacting with GStreamer, as
> this bug doesn't happen when playing files through KMPlayer with the Phonon
> backend or through gst123. So it should be reassigned back to amarok.

pastas4, please don't make decisions that belong to developers. Using the same reasoning you make this bug doesn't exist because it is not present when vlc phonon is used. (Amarok talks just to Phonon backed in implementation-specific thing) How do you know that KMPlayer and qst123 tests all functionality on Phonon? Have you checked that they for example use gapless playback?

This bug is watched by both Phonon and Amarok developers (i.e. me) so you can be assured it is assigned correctly. (taking information available in this bug to date into account)
Comment 15 Dainius Masiliūnas 2012-08-15 21:14:41 UTC
No offence intended there, I was just sharing the results of my tests and giving suggestions. Besides, a patch to Amarok reportedly changed the issue somewhat, so it further shows that it could be a bug only in Amarok. Of course, it would be nice if it was possible to assign it to both products, but that is not so.
Comment 16 Dainius Masiliūnas 2012-08-20 09:14:00 UTC
I just tested this in KDE 4.9 with Amarok 2.6.0 and phonon-backend-gstreamer 4.6.2, and it seems that the issue is fixed. I looped a playlist with 2 MP3 and 2 OGG files for a while, and it didn't stop once.
Comment 17 Matěj Laitl 2012-08-20 09:23:38 UTC
Seems to be resolved in phonon-gstreamer 4.6.2, good!
Comment 18 robert marshall 2012-08-27 12:11:17 UTC
I have gstreamer 4.6.2 (and amarok 2.6.0) and am still sometimes seeing this issue, though in the cases where it's happened its been from an ogg track to an mp3 (or flac) is this likely to be a differnet issue or is it the same problem?
Comment 19 fab 2012-08-30 17:12:42 UTC
I also confirm the problem is still present, with gstreamer 4.6.2 and amarok 2.6.0.
Comment 20 Myriam Schweingruber 2012-09-07 00:54:42 UTC
Reopening based on comments #18 and 19
Comment 22 Torrie Fischer 2012-09-22 10:14:40 UTC
(In reply to comment #19)
> I also confirm the problem is still present, with gstreamer 4.6.2 and amarok
> 2.6.0.

Can you please follow the steps outlined in http://techbase.kde.org/Development/Tutorials/Debugging/Phonon to produce a debug log?
Comment 23 Dainius Masiliūnas 2012-10-18 16:09:19 UTC
This is interesting, I just upgraded (via clean install) to KDE 4.9, which includes Amarok 2.6.0 and phonon-gstreamer 4.6.2, and I do still get the issue, like others said, every time. So this makes me wonder why my previous test case worked better. The only difference in the sound system that I can tell off the top of my head is that in my previous test I only had ALSA installed, while now I have PulseAudio. So it might be related to that, but I'll test some more and see if I can find more about the differences between the tests.

Meanwhile, I produced the debug logs, I'll attach them here.
Comment 24 Dainius Masiliūnas 2012-10-18 16:13:17 UTC
Created attachment 74631 [details]
Debug log, short

This log was obtained by running this command:

During the test, an MP3 track was played, then an OGG track was queued. It paused at the beginning of the track for around a minute, and then continued playing. I closed Amarok before it ended playing the OGG track.
Comment 25 Dainius Masiliūnas 2012-10-18 16:31:46 UTC
Created attachment 74632 [details]
Debug log, long

This is a log with extra debugging enabled, namely this:

In this case, I played an MP3 file, queued an OGG file, waited for it to resume playing and end playing. It then went on to play the next MP3 file, and then I closed Amarok.
Comment 26 Myriam Schweingruber 2012-10-30 10:55:23 UTC
*** Bug 309095 has been marked as a duplicate of this bug. ***
Comment 27 Myriam Schweingruber 2012-10-30 10:57:11 UTC
Setting status correctly. Raising bug status and importance as this makes playing music with that backend a real problem.
Comment 28 Dainius Masiliūnas 2012-11-01 10:37:24 UTC
I just did additional testing, and yes, this is related to PulseAudio. You can test it like this (tried on KDE 4.8.5, Amarok 2.5.0, PulseAudio 1.1, phonon-gstreamer 4.6.1, but should work on other versions too):

  echo "autospawn = no" >> ~/.pulse/client.conf && pulseaudio -k && amarok

Or manually, set autospawn to "no" in either ~/.pulse/client.conf or /etc/pulse/client.conf, then kill PulseAudio, and then try to play tracks. It should work then, OGG tracks no longer get paused.

Note that using pasuspender doesn't work, you must kill the daemon itself.
Comment 29 Myriam Schweingruber 2012-11-19 12:00:25 UTC
*** Bug 310261 has been marked as a duplicate of this bug. ***
Comment 30 Harald Sitter 2012-11-19 14:07:01 UTC
(In reply to comment #25)
> This is a log with extra debugging enabled, namely this:
> &>amarok-debug-copious.log

Please note that you have to use PHONON_SUBSYSTEM_DEBUG rather than PHONON_GST_GST_DEBUG since Phonon Gstreamer 4.6.0.

In fact the steps outlined at https://bugs.kde.org/show_bug.cgi?id=290706#c54 also apply to this bug in case someone needs a detailed list of what to do to get debug logs.

About the bug though, since unfortunately the long log from comment #25 is not actually containing gstreamer debug I am still in the dark about this issue. I fail to reproduce it with updated Kubuntu 12.04 + KDE SC 4.9 (PPA) + Amarok 2.6.0 (src) + Phonon GStreamer 4.6 (git) + Phonon 4.6 (git) so I don't see this report going anywhere without a debug log unfortunately. 

Also, FWIW, the short log from comment #24 is inconclusive as it contains exactly what is supposed to happen debugwise. song plays, abouttofinish is emitted, amarok sets new source, instead of ending the stream the source is changed on-the-fly and eventually gets stopped by quitting Amarok, so it would appear that perhaps one of the libraries is experiencing an overly long inter-thread locking somewhere.

Finally I have a couple of questions:
a) Is this reproducible with an entirely new user (i.e. a clean set of configs and an amarok where nothing was customized)?
b) Is Replay Gain on (Amarok menu bar -> settings -> replay gain) if not turn it on, otherwise turn it off. Does that change anything?
c) is PulseAudio running/installed? If so, what *exact* version (including distro revisions - e.g. latest on Kubuntu 12.04 is 1:1.1-0ubuntu1)
c-1) if PA is running, is it used? (Can be checked by setting PHONON_PULSEAUDIO_DEBUG=5 or in the Phonon configuration module which only shows the 'Audio Hardware Setup' tab when PA is used)
e) What is the exact version of gstreamer, phonon, phonon-gstreamer and amarok (including distro)

If you know how, it would also be greatly appreciated if you could try to reproduce the issue with phonon gstreamer 4.6 from git (branch: 4.6).
Comment 31 Harald Sitter 2012-11-19 14:07:38 UTC
Change status accordingly
Comment 32 Dainius Masiliūnas 2012-11-19 16:18:41 UTC
To answer your questions:
a) Yes, it is reproducible even on a clean installation of openSUSE 12.2. I believe that this can be tested by using the KDE LiveCD offered for download on their website. I also built my own LiveCD using SUSE Studio to check this issue. I could also give you a link to it, if you want to check that as well.
b) Tested when it was on Track. Disabling it makes no difference.
c) Yes, it only happens when PulseAudio is running (happens even if pasuspender is used, but no longer happens if PA is killed). The current version of it that I am using is 1.1-6.4.1.
e) amarok 2.6.0-169.1, libphonon4 4.6.0-90.1, phonon-backend-gstreamer-0_10 4.6.2-30.1

I'll see if I can get a workable log with PHONON_SUBSYSTEM_DEBUG (the log I get when using all the options together is more than 900 MiB in size, so obviously it cannot be uploaded anywhere to begin with), and possibly build the applications from source.
Comment 33 Harald Sitter 2012-11-19 16:42:07 UTC
Simply compress the log, xz -9 foo.log should do the trick.
Comment 34 Dainius Masiliūnas 2012-11-19 16:45:06 UTC
Created attachment 75356 [details]

Since anything above level 3 debug did not fit, I used it instead of level 5.
The exact command line was this:
Interestingly, there are gst_pulsering_stream_overflow_cb messages just as the OGG track starts playing, and it even refers to 0:02 seconds.
Comment 35 Harald Sitter 2012-11-19 18:35:46 UTC
Upstream bug fixed as per

Comment 36 Cédric Bellegarde 2013-11-07 13:21:12 UTC
Here, bug always present with amarok 2.8 and gstreamer0.10-base 0.10.36-1
Comment 37 Myriam Schweingruber 2013-11-07 13:35:52 UTC
(In reply to comment #36)
> Here, bug always present with amarok 2.8 and gstreamer0.10-base 0.10.36-1

Because the fix is in gstreamer master == 1.x, not 0.10.x

Ask your distribution to patch it.
Comment 38 David 2013-11-18 08:32:04 UTC
This bug is not really resolved, is it? If the root cause is fixed in Gstreamer 1.0, does this actually fix the problem in Amarok? Is it possible to use Gstreamer 1.0 with Phonon?
Comment 39 Myriam Schweingruber 2013-11-18 15:59:00 UTC
Not yet,  but the Phonon developers are working on it.