Fails to play a file with a # (hash symbol) in the path

Bug #1449790 reported by Neil McPhail
108
This bug affects 14 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
High
John McAleely
media-hub (Ubuntu)
Fix Released
High
Jim Hodapp
media-hub (Ubuntu RTM)
Fix Released
High
Jim Hodapp
qtubuntu-media (Ubuntu)
Fix Released
High
Jim Hodapp
qtubuntu-media (Ubuntu RTM)
Fix Released
High
Jim Hodapp

Bug Description

Playing a song from the music app will fail if the path contains a # symbol. The failure appears to be at the media-hub level.

Example: Try to play track under "Music/Lots of #1 hits/annoying_hit.mp3"

What should happen: Song should play

What actually happens: Song info loads in music player screen but track does not play and duration is set to zero.

This bug has been confirmed by ahayzen on #ubuntu-touch who submitted this example log: http://pastebin.ubuntu.com/10931522/

The file plays normally if the # is removed from the path.

Related branches

Revision history for this message
Neil McPhail (njmcphail) wrote :

krillin RTM release 21

Revision history for this message
Andrew Hayzen (ahayzen) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.
I can confirm that when using the package media-hub on vivid-proposed #182 mako using the steps provided by Neil that I can reproduce the bug. Therefore I have set this bug to confirmed.

Changed in media-hub:
status: New → Confirmed
Revision history for this message
Jim Hodapp (jhodapp) wrote :

This seems to be an issue with a function that gstreamer provides that checks for a valid URI. Might need to use something else to verify a valid URI since a '#' should be able to be used in a filename.

Changed in media-hub:
status: Confirmed → Triaged
assignee: nobody → Canonical Phone Foundations (canonical-phonedations-team)
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

We just had another duplicate (bug 1476311) of this in music, can we get a priority and/or milestone set for this?

James Lewis (james-fsck)
Changed in media-hub:
status: Triaged → Confirmed
Revision history for this message
James Lewis (james-fsck) wrote :

OK, my mistake... It was always my understanding that Confirmed was after Triaged... but that seems not to be the case...

Can someone clarify this?

Revision history for this message
Jim Hodapp (jhodapp) wrote :

Just think logically about it. Confirmed is when two or more people have been able to reproduce the bug and triaged is when the bug supervisor has been able to reproduce it which is vital to it being able to be fixed. Triaged is more important than confirmed because the person who is going to fix it can reproduce the bug.

Changed in media-hub:
status: Confirmed → Triaged
Changed in canonical-devices-system-image:
status: New → Confirmed
Revision history for this message
James Lewis (james-fsck) wrote :

Yes, i read that before observing that it was a mistake.... In medicine however, if you have a lot of patients at once, triage is the first step..... Thats the source of the confusion....

Jim Hodapp (jhodapp)
Changed in media-hub:
importance: Undecided → High
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

This comment I made in one of the duplicates and should probably be shown on the main bug :-)

https://bugs.launchpad.net/music-app/+bug/1470129/comments/2

So trying this locally with gst-launch

This works correctly
$ gst-launch-1.0 -v playbin uri=file:///home/andy/Music/INXS/The%20Greatest%20Hits/01%20-%20Mystify%23.flac

But this fails
$ gst-launch-1.0 -v playbin uri="file:///home/andy/Music/INXS/The Greatest Hits/01 - Mystify#.flac"
Setting pipeline to PAUSED ...
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: ring-buffer-max-size = 0
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: buffer-size = -1
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: buffer-duration = -1
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: use-buffering = false
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: download = false
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: uri = file:///home/andy/Music/INXS/The Greatest Hits/01 - Mystify#.flac
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: connection-speed = 0
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: source = "\(GstGioSrc\)\ source"
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstURIDecodeBin:uridecodebin0/GstGioSrc:source: Resource not found.
Additional debug info:
gstgiosrc.c(321): gst_gio_src_get_stream (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstGioSrc:source:
Could not open location file:///home/andy/Music/INXS/The%20Greatest%20Hits/01%20-%20Mystify for reading: Error opening file: No such file or directory
Setting pipeline to NULL ...
Freeing pipeline ...

I suspect this latter case is occurring and either we or media-hub need to be encoding the URI correctly.

Revision history for this message
Jim Hodapp (jhodapp) wrote :

The issue is definitely that playbin is getting passed the raw URI, which it does not like. It seems from Andrew's comment above that it prefers a fully encoded URI which makes sense given that the playbin property's field name is "uri".

Revision history for this message
Neil McPhail (njmcphail) wrote :

Interestingly, the qt encode/decode functions don't seem to alter # symbols. I have been hacking the qtubuntu-media code to manually convert # symbols to "%23" all the way to the "m_hubPlayerSession->open_uri(uri);" in "AalMediaPlayerService::setMedia", without any improvement in behaviour. I suspect this means I need to repeat the experiment in the media hub code?

Revision history for this message
Jim Hodapp (jhodapp) wrote :

So you've passed what you are sure is a correctly encoded URI to AalMediaPlayerService::setMedia() and GStreamer is still refusing to play that URI? If so, nothing you do in media-hub will fix that as it's should be simply passing this URI straight through to GStreamer's playbin uri field. You should be able to test what GStreamer is capable of with gst-launch-1.0 and pass it playbin uri=file:///my_path/my.mp3

Revision history for this message
Neil McPhail (njmcphail) wrote :

My final experiment was as per the attached patch (from bzr rev 68), so I _think_ this takes care of the latest point qtmedia-ubuntu touches those uri's.

Revision history for this message
Jim Hodapp (jhodapp) wrote : Re: [Bug 1449790] Re: Fails to play a file with a # (hash symbol) in the path

Did you give QUrl::toEncoded a try? I think this function will accomplish
exactly what you want without needing to do specific manual encoding of the
string: http://doc.qt.io/qt-5/qurl.html#toEncoded

On Sun, Aug 16, 2015 at 3:07 PM, Neil McPhail <email address hidden> wrote:

> My final experiment was as per the attached patch (from bzr rev 68), so
> I _think_ this takes care of the latest point qtmedia-ubuntu touches
> those uri's.
>
> ** Patch added: "fromr68.diff"
>
> https://bugs.launchpad.net/media-hub/+bug/1449790/+attachment/4445549/+files/fromr68.diff
>
> --
> You received this bug notification because you are a member of Canonical
> Phone Foundations, which is a bug assignee.
> https://bugs.launchpad.net/bugs/1449790
>
> Title:
> Fails to play a file with a # (hash symbol) in the path
>
> Status in Canonical System Image:
> Confirmed
> Status in Media Hub:
> Triaged
>
> Bug description:
> Playing a song from the music app will fail if the path contains a #
> symbol. The failure appears to be at the media-hub level.
>
> Example: Try to play track under "Music/Lots of #1
> hits/annoying_hit.mp3"
>
> What should happen: Song should play
>
> What actually happens: Song info loads in music player screen but
> track does not play and duration is set to zero.
>
>
> This bug has been confirmed by ahayzen on #ubuntu-touch who submitted
> this example log: http://pastebin.ubuntu.com/10931522/
>
> The file plays normally if the # is removed from the path.
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/canonical-devices-system-image/+bug/1449790/+subscriptions
>

Revision history for this message
Neil McPhail (njmcphail) wrote :

Yes, I've played with the various option for that function. I don't think any of them affect # symbols anyway, but coding the replace by hand ensures the hash symbol is replaced at the point "m_hubPlayerSession->open_uri(uri);" is called.

It still doesn't work.

So something either happens to the std::string which is used to make the "const media::Track::UriType" in the constructor, or the uri is re-mangled somewhere further downstream. Chasing the code further is beyond my skill, as the media-hub code gets into proper C++ territory and I only really know C.

Any help appreciated.

Revision history for this message
Jim Hodapp (jhodapp) wrote :

media-hub doesn't do a thing to the URI. media::Track::UriType is just a
typedef for std::string. So that's why I'm recommending that you first know
what URI encodings will work for GStreamer via gst-launch-1.0 because then
you can be sure that you are passing the right thing to media-hub. If at
that point it still doesn't work, then perhaps something is affecting it
somewhere on its way down to playbin.

On Sun, Aug 16, 2015 at 3:38 PM, Neil McPhail <email address hidden> wrote:

> Yes, I've played with the various option for that function. I don't
> think any of them affect # symbols anyway, but coding the replace by
> hand ensures the hash symbol is replaced at the point
> "m_hubPlayerSession->open_uri(uri);" is called.
>
> It still doesn't work.
>
> So something either happens to the std::string which is used to make the
> "const media::Track::UriType" in the constructor, or the uri is re-
> mangled somewhere further downstream. Chasing the code further is beyond
> my skill, as the media-hub code gets into proper C++ territory and I
> only really know C.
>
> Any help appreciated.
>
> --
> You received this bug notification because you are a member of Canonical
> Phone Foundations, which is a bug assignee.
> https://bugs.launchpad.net/bugs/1449790
>
> Title:
> Fails to play a file with a # (hash symbol) in the path
>
> Status in Canonical System Image:
> Confirmed
> Status in Media Hub:
> Triaged
>
> Bug description:
> Playing a song from the music app will fail if the path contains a #
> symbol. The failure appears to be at the media-hub level.
>
> Example: Try to play track under "Music/Lots of #1
> hits/annoying_hit.mp3"
>
> What should happen: Song should play
>
> What actually happens: Song info loads in music player screen but
> track does not play and duration is set to zero.
>
>
> This bug has been confirmed by ahayzen on #ubuntu-touch who submitted
> this example log: http://pastebin.ubuntu.com/10931522/
>
> The file plays normally if the # is removed from the path.
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/canonical-devices-system-image/+bug/1449790/+subscriptions
>

Jim Hodapp (jhodapp)
Changed in media-hub (Ubuntu):
status: New → Triaged
Changed in media-hub (Ubuntu RTM):
status: New → Triaged
no longer affects: media-hub
Changed in media-hub (Ubuntu):
importance: Undecided → Low
Changed in media-hub (Ubuntu RTM):
importance: Undecided → Low
Changed in qtubuntu-media (Ubuntu):
status: New → Triaged
Changed in qtubuntu-media (Ubuntu RTM):
status: New → Triaged
Changed in qtubuntu-media (Ubuntu):
importance: Undecided → Low
Changed in qtubuntu-media (Ubuntu RTM):
importance: Undecided → Low
Changed in canonical-devices-system-image:
importance: Undecided → High
assignee: nobody → John McAleely (john.mcaleely)
milestone: none → ww08-2016
Revision history for this message
Michał Sawicz (saviq) wrote :

Related is bug #1535798, need to coordinate what are the comm points and what is expected where.

Revision history for this message
Jim Hodapp (jhodapp) wrote :

Bumped importance to High since this is blocking other work.

Changed in media-hub (Ubuntu):
importance: Low → High
Changed in media-hub (Ubuntu RTM):
importance: Low → High
Changed in qtubuntu-media (Ubuntu):
importance: Low → High
Changed in qtubuntu-media (Ubuntu RTM):
importance: Low → High
Revision history for this message
James Henstridge (jamesh) wrote :

'#' and '?' are reserved URI characters, used as separators for the query and fragment components respectively. So a URI like "file:///Mystify#.flac" is correctly parsed as having a path component of "/Mystify" and fragment component ".flac".

If music-app is producing URIs containing these characters but intending them to be part of the path component, then that is an error. If you want to convert between URLs and file names, Qt provides QUrl::toLocalFile and QUrl::fromLocalFile methods. These will take care of the necessary escaping. They don't seem to be exposed on the QML URL type though, so would probably need a C++ plugin to expose.

If music-app still has the URIs provided by mediascanner, they should also be well formed with correct escaping.

Revision history for this message
Albert Astals Cid (aacid) wrote :

James, that doesn't matter, it's just on the phone that it fails, not on the desktop, so it's obviously not QML's fault.

https://bugs.launchpad.net/ubuntu/+source/qtmultimedia-opensource-src/+bug/1541811

Revision history for this message
Jim Hodapp (jhodapp) wrote :

Adding a media-hub.log for reference, see: http://pastebin.ubuntu.com/14996296/

Jim Hodapp (jhodapp)
Changed in canonical-devices-system-image:
status: Confirmed → In Progress
Changed in media-hub (Ubuntu):
status: Triaged → In Progress
Changed in media-hub (Ubuntu RTM):
status: Triaged → In Progress
Changed in qtubuntu-media (Ubuntu):
status: Triaged → In Progress
Changed in qtubuntu-media (Ubuntu RTM):
status: Triaged → In Progress
Changed in media-hub (Ubuntu):
assignee: nobody → Jim Hodapp (jhodapp)
Changed in media-hub (Ubuntu RTM):
assignee: nobody → Jim Hodapp (jhodapp)
Changed in qtubuntu-media (Ubuntu):
assignee: nobody → Jim Hodapp (jhodapp)
Changed in qtubuntu-media (Ubuntu RTM):
assignee: nobody → Jim Hodapp (jhodapp)
Jim Hodapp (jhodapp)
Changed in qtubuntu-media (Ubuntu RTM):
status: In Progress → Fix Committed
Changed in qtubuntu-media (Ubuntu):
status: In Progress → Fix Committed
Changed in media-hub (Ubuntu RTM):
status: In Progress → Fix Committed
Changed in media-hub (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Albert Astals Cid (aacid) wrote :

Which package version of qtubuntu-media and media-hub should i be using for this to be fixed? Or alternatively which branches have the fixes?

Jim Hodapp (jhodapp)
Changed in media-hub (Ubuntu):
status: Fix Committed → In Progress
Changed in media-hub (Ubuntu RTM):
status: Fix Committed → In Progress
Changed in qtubuntu-media (Ubuntu):
status: Fix Committed → In Progress
Changed in qtubuntu-media (Ubuntu RTM):
status: Fix Committed → In Progress
Jim Hodapp (jhodapp)
Changed in media-hub (Ubuntu):
status: In Progress → Fix Committed
Changed in media-hub (Ubuntu RTM):
status: In Progress → Fix Committed
Changed in qtubuntu-media (Ubuntu):
status: In Progress → Fix Committed
Changed in qtubuntu-media (Ubuntu RTM):
status: In Progress → Fix Committed
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

This bug was fixed in the package qtubuntu-media 0.8.0+15.04.20160222.1-0ubuntu1 in https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/stable-phone-overlay

---------------

qtubuntu-media (0.8.0+15.04.20160222.1-0ubuntu1) vivid; urgency=medium

  * URI encode the URI that we call setMedia() on or add to the playlist
    (LP: #1449790)

qtubuntu-media (0.8.0+16.04.20160114.1-0ubuntu1) xenial; urgency=medium

  * Make sure to catch and report the exception
    InsufficientPermissionsToAddTrack (LP: #1533779)

qtubuntu-media (0.8.0+16.04.20160113-0ubuntu1) xenial; urgency=medium

  [ Andrew Hayzen ]
  * Until bug 1518157 (RandomAndLoop playbackMode) is fixed set Random
    to be always looping due to bug 1531296 (LP: #1531296, #1518157)

qtubuntu-media (0.8.0+16.04.20160112.1-0ubuntu1) xenial; urgency=medium

  [ CI Train Bot ]
  * No-change rebuild.

qtubuntu-media (0.8.0+16.04.20160105-0ubuntu1) xenial; urgency=medium

  [ CI Train Bot ]
  * No-change rebuild.

 -- Jim Hodapp <email address hidden> Mon, 22 Feb 2016 19:00:10 +0000

Changed in qtubuntu-media (Ubuntu RTM):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

This bug was fixed in the package media-hub 4.1.0+15.04.20160222-0ubuntu1 in https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/stable-phone-overlay

---------------

media-hub (4.1.0+15.04.20160222-0ubuntu1) vivid; urgency=medium

  * Make sure to interpret the incoming path as a URI which makes sure
    media-hub will always be able to open the track with an encoded URI
    (LP: #1449790)

media-hub (4.1.0+16.04.20160127-0ubuntu1) xenial; urgency=medium

  [ Simon Fels ]
  * Don't depend on a specific hybris version anymore.

  [ Thomas Voß ]
  * Adjust apparmor profile to enable flawless audio/video playback.

media-hub (4.1.0+16.04.20160115.1-0ubuntu1) xenial; urgency=medium

  * Make sure that an apparmor profile_name of the format com.ubuntu.my-
    app is supported as well as improve the error handling and reporting
    for when a client does not have the proper apparmor permissions to
    play a given media URI (LP: #1533779)

media-hub (4.1.0+16.04.20160104-0ubuntu1) xenial; urgency=medium

  * Enable dual landings.

media-hub (4.1.0+16.04.20151221-0ubuntu1) xenial; urgency=medium

  * Fix bug #1479036 which prevents the out_of_range exception from
    causing media-hub-server from crashing when a player key is not
    found (LP: #1479036)

media-hub (4.1.0+15.10.20151016.1-0ubuntu1) wily; urgency=medium

  [ Simon Fels ]
  * Prevent us from leaking file descriptors and memory due to not releasing
    gstreamer elements correctly.

  [ Alfonso Sanchez-Beato ]
  * Avoid getting additional references for audio_sink, which were not
    being freed. Also, remove unneeded unrefs that must be performed in
    gstreamer instead.
  * Emit CanPlay, CanPause, and CanGo[Next|Previous] in the mpris object path

  [ Jim Hodapp ]
  * Make sure the correct player is set as the current player controled by
    MPRIS.
  * Improved the can_go_next() and can_go_previous() logic to always return
    true if the loop_status is currently set to loop over the entire
    playlist.

  [ CI Train Bot ]
  * No-change rebuild.

 -- Jim Hodapp <email address hidden> Mon, 22 Feb 2016 18:59:52 +0000

Changed in media-hub (Ubuntu RTM):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package media-hub - 4.1.0+16.04.20160222-0ubuntu1

---------------
media-hub (4.1.0+16.04.20160222-0ubuntu1) xenial; urgency=medium

  * Make sure to interpret the incoming path as a URI which makes sure
    media-hub will always be able to open the track with an encoded URI
    (LP: #1449790)

 -- Jim Hodapp <email address hidden> Mon, 22 Feb 2016 18:59:52 +0000

Changed in media-hub (Ubuntu):
status: Fix Committed → Fix Released
Changed in canonical-devices-system-image:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qtubuntu-media - 0.8.0+16.04.20160222.1-0ubuntu1

---------------
qtubuntu-media (0.8.0+16.04.20160222.1-0ubuntu1) xenial; urgency=medium

  * URI encode the URI that we call setMedia() on or add to the playlist
    (LP: #1449790)

 -- Jim Hodapp <email address hidden> Mon, 22 Feb 2016 19:00:10 +0000

Changed in qtubuntu-media (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Neil McPhail (njmcphail) wrote :

This doesn't seem to be fixed 100% in OTA10:

1) Play a track without a "#" in the path from the music app
2) Click the "Search" area in the "Songs" tab, and search for your track with a "#" in the path
3) select the track - instead of playing the new file with the "#" in the path, the original track will be restarted

Changed in canonical-devices-system-image:
status: Fix Committed → Fix Released
Revision history for this message
Jim Hodapp (jhodapp) wrote :

@Neil: Can you please give me an example or two of the filenames that still don't play? Please copy and paste them verbatim. Also, please give me the media-hub.log file located at /home/phablet/.cache/upstart/media-hub.log. First clear this file and then repeat the scenario that you listed in comment #26. Thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.