Jolla-mediaplayer choppy playback while streaming

REPRODUCIBILITY: 100%
BUILD ID = OS VERSION: 4.2.0.19 EA
HARDWARE: Xperia 10 II
UI LANGUAGE: English
REGRESSION: No, but has always been a problem

DESCRIPTION:

type into the browser; www.somafm.com/groovesalad.pls
When the PLS has downloaded, open it from Transfers.
Mediaplayer should open and start streaming the playlist which it does but is extremely choppy for many minutes, then it calms a little but still breaks up every few minutes.

PRECONDITIONS:

As above

STEPS TO REPRODUCE:

  1. As above the above

EXPECTED RESULT:

Little to no choppiness at all

ACTUAL RESULT:

Too much choppiness to make the stream worth listening to.

ADDITIONAL INFORMATION:

Playing the same stream DIRECTLY from somafm’s website in Sailfish Browser yields perfect results, no choppiness at all unlike Mediaplayers abysmal attempts.

3 Likes

This has been an issue for a long long time, I’ve reported it directly as it ruins my own Apps experience and it’s been looked into by some on the team but as of yet seen any improvement, there are patches that increase the buffer size which seem to help but not everyone wants to install patches.

1 Like

Music Player Daemon (MPD) | OpenRepos.net — Community Repository System does not suffer these stuttering issues, as it does not use the crippled QtMultimedia SFOS component, but handles streaming by itself.

Setting up mpd and the SMPC [fork] | OpenRepos.net — Community Repository System front-end initially may be a bit of a hassle thought, not advised for people with zero to none linux cli experience.

1 Like

Added to internal tracker

6 Likes

@vige
The stuttering problem still exists in Sauna 4.6.0.13. It seems to be more of an issue on the WLAN connection than on mobile data.

Another issue:
While playing a radio stream, no song information (artist and song title) was displayed within the app, only “Unknown Artist”. However, the radio station (http://radio-paralax.de:8000/) supports it, as tested with Deadbeef-Silica (see the last screenshot).


In Deadbeef-Silica it works:

1 Like

Just my own experience on streaming from a local MPD server with the media player is that when you decrease the nice value on the running mediaplayer it will get more resources from the kernel and works a bit better. So you could try to:

renice -n 0 $(pidof jolla-mediaplayer)

Nice value goes from -20 to 20. As a regular user you can set values 0…20. For lower values you need to user root user (devel-su). By default mediaplayer seems to have nice value of 10. In brief, the higher the nice value is the more the process will be scheduled to wait for resources.

Try with the nice value 0 first if it has any effect. Then you can experiment with lower values but that may have some drawbacks in other functionality of your Sailfish OS device.

For me its sound like the streaming-buffer size is too small and it reach often end of the buffer during play. So i see no need to play around with the Taskpriority, other Players (that i dunno want to use) have no problem with it also with low Task-Priorities.

1 Like

It most likely is that too, but in general, if the application is too nice and waits longer when it would need to get access to the resources it needs for the playback stuttering will happen at times. Not a solution, but an hint to see if it helps.

I made a basic mediaplayer, it automatically loads my favourite stream, GrooveSalad from somafm.com.

Please note, the artist name…

My player has no buttons, only a display. My display reveals stream details, track name, artist name, bit rate, transport type, description, etc…all this without ANY stuttering. Comparing this to Jolla Mediaplayer is like comparing night and day.

I’m going to go out on a limb here and say, I think the code in jolla-mediaplayer for data streams needs to be rewritten. I made plenty of mistakes making my basic player, where the stream stuttered or did not even get started, I eventually got it right, my player does not stutter, ok, maybe once when getting started.

My first car dashboard I built for my Xperia 10II included a media player, could I get it to stream properly with metadata?, nope!, it stuttered (sound familiar?), kept stuttering and eventually settled after many minutes, with occasional dropouts. If I disabled the metadata stream, the stuttering was completely eradicated, so I can’t help but think Jolla should take a fresh look at how their mediaplayer deals with metadata.

One thing I notice; jolla-mediaplayer displays UNKNOWN ARTIST for SomaFM’s Groove Salad stream, where as my mediaplayer DOES show the artists name and without stuttering.

I don’t think there is any need to tinker with anything (i.e. renice) except the code chunks that deal with metadata streaming.

My code for metadata retrieval;

import QtQuick 2.6
import Sailfish.Silica 1.0
import QtGraphicalEffects 1.0
import QtMultimedia 5.6

Page {

    allowedOrientations: Orientation.Landscape | Orientation.LandscapeInverted

    Rectangle {
        id: padding
        radius: 40
        color: "dodgerblue"
        width: 1600; height: 180
        anchors.centerIn: parent
        border { width: 2; color: "gold" }

        Rectangle {
            id: screen
            color: "dodgerblue"
            width: 1500; height: 160
            clip: true; radius: 40
            anchors.centerIn: parent

            Label {
                id: printer
                property int i
                property string sourceText: title.text + " " + audioBitRate.text + " " + audioCodec.text + " " + publisher.text + " " + genre.text
                function type() {
                    text = sourceText.slice(0, ++i);
                    if (text === sourceText)
                        printer.text = text;
                }
                color: "#a0090909"
                anchors.verticalCenter: screen.verticalCenter
                font { pixelSize: 72; bold: true; italic: false }

                NumberAnimation on x {
                    id: animation
                    duration: 30000
                    from: screen.width
                    to: -screen.width*3
                    alwaysRunToEnd: true
                    loops: Animation.Infinite
                }
                Timer {
                    id: timer; interval: 100
                    repeat: true; running: true
                    onTriggered: printer.type()
                }
                MediaPlayer {
                    id: player; source: "https://ice4.somafm.com/groovesalad-128-mp3"
                }
                Component.onCompleted: player.play()

                Item {
                    id: conveyor
                    visible: false
                    smooth: true; antialiasing: true
                    anchors.verticalCenter: parent.verticalCenter
                    Label { id: title; text: player.metaData.title ? player.metaData.title : " " }
                    Label { id: audioBitRate; text: player.metaData.audioBitRate ? Math.max(player.metaData.audioBitRate/1000).toFixed(0) + " kbps": " " }
                    Label { id: audioCodec; text: player.metaData.audioCodec ? player.metaData.audioCodec : " " }
                    Label { id: publisher; text: player.metaData.publisher ? player.metaData.publisher : " " }
                    Label { id: genre; text: player.metaData.genre ? player.metaData.genre : " " }
                }
            }
            DropShadow {
                source: printer; anchors.fill: printer
                verticalOffset: 6; horizontalOffset: -6
                color: "#a0494949"; samples: 17; radius: 8.0
            }
        }
    }
}

1 Like

sure it is streaming buffer!
i have two jolla 1 phones ,
one is running my fav SFOS v1.1.7.28 - NO ISSUES with stream even when listening hi quality Icecast (qual 8 = 200-800kbps) - runs absolutely smoothly !
other Jolla 1 is running on SFOS v3.4 and it does stuttering, same for v4.6: Xperia 10Plus, Xperia 10 II, Xperia 10 V, Tablet…

on the old system there is about 2 sec delay before stream start playing (buffering)
newer SFOS start playing almost instantly and it just unusable because of just terrible stuttering…
so please fix this :wink:

On C2 the steaming starting also instantly but need about 30-60 seconds to adapt its cache-size so it seems, not very optimal. I would add some more buffertime instead of the instantly playing. And this only on stable Internet-Connections like over WLAN. When trying to stream from mobile data stuttering is much more often worse.

SFOS v1.1.7.28 absolutely no issues even on mobile data, listening in car almost daily hi-quality Icecast and never had buffer under-run. No idea why they “improved” this what was working perfectly in old version…

1 Like

Another Issue is the Title Display ond the Car-Audio. When BT-Connection is enabled the Music-Title is shown once but you can’t use the Mediaplayer-Control until you perform a MPRIS-Reset but then the Title-Display vanished.

found attempt to fix buffering 4 years ago [QMultimedia/GStreamer] Set the buffer size higher to avoid stuttering - together.jolla.com