Bug 310763 - phonon-qst 4.6.2 fails to emit finished() even though audio stops and aboutToFinish() is already emitted when seeking in a Last.fm stream
Summary: phonon-qst 4.6.2 fails to emit finished() even though audio stops and aboutTo...
Status: RESOLVED FIXED
Alias: None
Product: phonon-backend-gstreamer
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 4.6.2
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: 4.7
Assignee: Harald Sitter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-27 13:55 UTC by Marco Napetti
Modified: 2013-01-31 23:18 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.6.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Napetti 2012-11-27 13:55:06 UTC
I'm experiencing an annoing problem with amarok's last.fm integration.
My web radio sometimes stops and I have to exit amarok and open it again to be able to listen to it again.

Launching amarok from a shell, I see all QUrl debug messages with an "OK" response, for example:
HTTP POST:  QUrl( "http://post2.audioscrobbler.com:80/protocol_1.2" )  "s=7d5bf4202a464f56aff002729f4d404a&a[0]=The%20Cr%C3%BCxshadows&t[0]=Purgatory&i[0]=1352209554&o[0]=P&r[0]=&l[0]=110&b[0]=Telemetry%20Of%20A%20Fallen%20Angel&n[0]=0&m[0]=" 
HTTP POST:  QUrl( "http://post.audioscrobbler.com:80/np_1.2" )  "s=7d5bf4202a464f56aff002729f4d404a&a=Within%20Temptation&t=Dark%20Wings&b=Mother%20Earth&l=255&n=0&m=" 
"OK" 
"OK"

Until this warning appears:
(amarok:31273): GLib-GObject-WARNING **: g_object_set_valist: object class `WebKitWebSrc' has no property named `user-agent'

After this appeared, I am unable to listen to my web radio and everytime I try to start a new song from last.fm a new warning appears and no music is played.

Restarting amarok everyting works fine until next warning.

Reproducible: Sometimes
Comment 1 Matěj Laitl 2012-12-17 12:43:51 UTC
I suffer from the same problem, let's see if I can resolve it before 2.7 final. Currently there seem to be 2 error, one is our suboptimal handling on Lasf.dm radio and second seems like Last.fm server stopping sending audio stream... And yes, I get the same GLib-GObject-WARNING **: g_object_set_valist: object class `WebKitWebSrc' has no property named `user-agent' message and I'm completely clueless why it is there - we don't explicitly use WebKit in any way.
Comment 2 Matěj Laitl 2012-12-17 15:32:39 UTC
I've found the root of the problem is phonon-backend-gstreamer not emitting finished(), thus Amarok thinks it is still playing, thus it is unusable until restart.

Steps to reproduce:
1. Install Amarok at least 2.7 Beta
2. Be a Last.fm subscriber (sorry)
3. Use phonon-gst 4.6.2
4. Start Amarok as: amarok -d --nofork 2>&1 | grep -C4 EngineController
5. Start for example Last.fm My Mix Radio
6. Wait for song to appear and playback to start
7. seek within a song. (note that Amarok's seek function checks MediaObject::isSeekable() and it returns true, phonon-vlc 0.6.1 seeks Last.fm streams fine even though Last.fm says it shouldn't be done) The audible playback stops and aboutToFinish() signal is emitted
8. No finished() signal is delivered (would be visible as slotFinished() slot), which keeps Amarok stuck.

Note that Last.fm poses following restrictions on their streams [1]:
> Use the location nodes to fetch individual tracks. All tracks must be requested once and only once,
> in the order supplied in the XSPF. Requesting the same track multiple times will result in an HTTP
> error returned from our streamers. Note that the track URLs provided will force an HTTP 302 redirect
> to the actual track location.
> Please ensure your streaming library supports HTTP redirects when fetching tracks
> 
> All tracks streamed are encoded as 128kbps MP3 files. We recommend clients begin playback as
> soon as a reasonable buffer (6-8 seconds) has been fetched. Do not attempt to store the file locally
> other than maintaining a reasonable buffer.
> Pausing playback is strictly not allowed and our streamers will return an error if you attempt to
> reconnect to the track more than once.

[1] http://www.last.fm/api/radio

This problem can be reproduced even without seeking, just by listening to a Last.fm radio for some time.

phonon-vlc 0.6.1 works fine and is a recommended work-around for this problem currently.
Comment 3 Christoph Feck 2012-12-20 21:05:02 UTC
> phonon-backend-gstreamer not emitting finished()

I have long wondered about that, too.

knotify4 relies on this signal to clean up players after they are finished. If the signal is never emitted, it will leak them.
Comment 4 Rohan Garg 2013-01-28 17:31:59 UTC
An issue regarding webkit has been opened here : https://bugs.webkit.org/show_bug.cgi?id=108088

This issue also seems to affect tomahawk and goes away if I revert commit 8d638f45a7b112fa272e19d361aa8ec485b71a2b from phonon-gstreamer.

Adding Trever to get his opinion on this.
Comment 5 Matěj Laitl 2013-01-29 19:45:01 UTC
(In reply to comment #4)
> An issue regarding webkit has been opened here :
> https://bugs.webkit.org/show_bug.cgi?id=108088
> 
> This issue also seems to affect tomahawk and goes away if I revert commit
> 8d638f45a7b112fa272e19d361aa8ec485b71a2b from phonon-gstreamer.

Good insight, thanks for sharing this.
Comment 6 Harald Sitter 2013-01-31 23:18:20 UTC
fixed for 4.6.3 in efdc92f2de8dc47abbc5af2de9c2bcc5e6cf0200

user-agent is now only set when the property actually exists, which resolves the problem according to testing by Rohan and Teo. the underlying problem that webkit leaks source plugins into phonon still exits but it should have no impact at this time. also webkit is tracking that leakage already.