[Phone] Please enable opus audio codec support in qtmultimedia

Bug #1630399 reported by Devid Antonio Filoni
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
High
Alfonso Sanchez-Beato
gst-plugins-bad0.10 (Ubuntu)
Fix Released
Undecided
Devid Antonio Filoni
qtmultimedia-opensource-src (Ubuntu)
Fix Released
Undecided
Devid Antonio Filoni

Bug Description

Hi, as described in QTBUG-50567 [1], qtmultimedia doesn't support opus audio codec so for example we cannot record Telegram voice messages ( bug #1460464 and bug #1375179 ).

I patched qtmultimedia adding the support for audio/x-opus codec through opusdec encoder in qtmultimedia, then I found qtmultimedia 5.4.1 (shipped with Ubuntu Phone vivid) is built against gstreamer0.10 and, as gstreamer0.10-plugins-bad packages is not installed by default, opusdec encoder is not available.

I'm working on this bug, I created it to track the progress, in order to add opus support I have to:

1 - create a new gstreamer0.10-opus package containing only the opusdec plugin: I don't know whether I have to create a new source package containing opusdec sources or only a new .deb package (generated from gst-plugins-bad0.10 sources). I'm working on the latter as gst-plugins-bad0.10 package requires work in any ways.

2 - properly patch qtmultimedia source, I'm attaching a working-but-needs-cleanup patch. I think some opus declarations in the attached patch can be avoided, but I haven't had time to work on it so I'm attaching the patch I tested (requires gstreamer0.10-plugins-bad).
I don't know if qtmultimedia xenial/yakkety versions requires the patch too, I haven't checked them yet.

[1] https://bugreports.qt.io/browse/QTBUG-50567

Tags: patch
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :
description: updated
Changed in gst-plugins-bad0.10 (Ubuntu):
assignee: nobody → Devid Antonio Filoni (d.filoni)
status: New → In Progress
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

I'm attaching a debdiff against qtmultimedia-opensource-src_5.4.1-1ubuntu19~overlay4 vivid package which contains the cleaned qtmultimedia patch. Tested on mako (rc-channel).

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

This is the qtmultimedia-opensource-src patch extracted from previous debdiff, this patch should be applied also to xenial/yakkety packages

tags: added: patch
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

This is a debdiff for gst-plugins-bad0.10_0.10.23-7.4ubuntu2 vivid package. opus plugin is now installed by a new gstreamer0.10-opus package. Tested on mako, not needed in xenial/yakkety since the opus plugin is in -base package.

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

I tested these packages using ~d.filoni/telegram-app/audio_receiving_and_sending telegram-app branch (stable enough), it doesn't work without opusdec support. The recorder settings are declared in the following code (telegram/app/qml/components/AudioRecordingBar.qml):

    AudioEncoderSettings {
        id: audioEncoderSettings
        codec: "audio/x-opus"
        sampleRate: 16000
        channelCount: 1
    }

The AudioEncoderSettings component is provided by AsemanAudioEncoderSettings C++ class (parent class: QAudioEncoderSettings). The recorder component is provided by AsemanAudioRecorder class which internally uses QAudioRecorder. Aseman class files can be found in telegram/app/asemantools/ directory.

Revision history for this message
Andrea Bernabei (faenil) wrote :

Hi Devid,
"it doesn't work without opusdec support" -> I'm a bit confused by this sentence, do you mean that it doesn't work without your patch (but with the attached patch it starts working), or that the problem does not have a solution yet?

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

Hi Andrea,
my telegram-app branch adds voice messages sending feature however it doesn't work without opusenc (opusdec is a typo) support.
Opusenc support is introduced by the qtmultimedia patch I attached, so this bug has a solution :) Everything is working fine on my device (mako) with my patches and I'm able to send telegram voice messages.

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

To be clear these patches are waiting for a review ;)

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Sorry Devid for the wait, we are definitely very happy to land these fixes! We need to just decide who/when will land it.

So action items, since I'm away at least next week:
1. Jin will check with Lukasz (sil2100) on whether he could help getting a silo to land the fixes to vivid OTA. The patches from Devid should be pretty much fine as is.
2. Someone please re-check if this is already fixed in xenial-overlay and zesty or not. This week I heard it would be fixed in the very latest packages, but need to confirm.

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

Oh, don't worry for the wait, I know you're busy working on higher-priority tasks ;) I'm really happy everything is fine, I'll continue to work on the telegram patch once I have free time :)

If this is going to be fixed in other ways in xenial/yakkety/zesty, please make sure that the QAudioEncoderSettings codec string is "audio/x-opus" (I used the one in gstreamer opusenc plugin documentation but I'm not really sure about it)

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

Will get to landing the QtMultimedia patch sometime soon.

Changed in canonical-devices-system-image:
assignee: nobody → Jim Hodapp (jhodapp)
milestone: none → 14
status: New → In Progress
Changed in canonical-devices-system-image:
assignee: Jim Hodapp (jhodapp) → Alfonso Sanchez-Beato (alfonsosanchezbeato)
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

@timo-jyrinki regarding whether this is fixed in xenial or newer:

1. xenial uses qtmultimedia 5.5.1, which depends on gstreamer1.0
2. gstreamer1.0 moved the opus[dec|enc] codecs to plugins-base in version 1.8, which is included by default in phone images

So yes, this should be solved in xenial and newer.

Note also that this issue is happening because qtmultimedia 5.4.1 uses old gstreamer 0.10. In fact you can already use opus in OTA13 by using directly gstreamer1.0 instead of via Qt.

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

I can confirm the gstreamer patch is not needed in xenial as described by Alfonso, however qtmultimedia patch is needed as the opus encoder is installed but it is not recognized by QGstreamerAudioEncode (it is not mapped).

Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

Another note: playing opus works just fine because the code path in that case goes through qtmultimedia -> qtubuntu-media -> media-hub -> gstreamer 1.0.

So the missing thing is opus encoding in vivid for qtmultimedia/gstreamer 0.10, and that is what Devid's patches fix.

Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

@d.filoni oh, I see, there is some glue code missing in qtmultimedia in all versions. That needs landing in xenial too indeed :)

Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

@d.filoni, you can find gstreamer0.10 and qtmultimedia packages in https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/2147

Please give the silo a try and let us know if things work as expected.

Changed in canonical-devices-system-image:
importance: Undecided → High
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

@Alfonso: thank you, I'll test it once I'm back at home. Please note: in my qtmultimedia patch I haven't added gstreamer0.10-opus package as depencency so it needs to be installed on devices (I don't know how packages selection works in phone).

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

Tested on mako (vivid). Silo #2147 works fine (after installing gstreamer0.10-opus package) ;)

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qtmultimedia-opensource-src - 5.6.1-2ubuntu3~1

---------------
qtmultimedia-opensource-src (5.6.1-2ubuntu3~1) zesty; urgency=medium

  [ Devid Antonio Filoni ]
  * Add opusenc support needed by Telegram app (LP: #1630399)

 -- Alfonso Sanchez-Beato (email Canonical) <email address hidden> Fri, 04 Nov 2016 12:42:19 +0100

Changed in qtmultimedia-opensource-src (Ubuntu):
status: In Progress → Fix Released
Changed in canonical-devices-system-image:
status: In Progress → Fix Committed
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Also fixed in vivid's gst0.10, and added gstreamer0.10-opus to vivid seed.

Changed in gst-plugins-bad0.10 (Ubuntu):
status: In Progress → Fix Released
Changed in canonical-devices-system-image:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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