Ticket #1614 (closed defect: fixed)
Mediaplayer isn't able to play Ogg/Vorbis files
| Reported by: | HdR | Owned by: | john_lee |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | unknown | Version: | 2007.2 |
| Severity: | critical | Keywords: | openmoko-mediaplayer |
| Cc: | calestyo@…, ace@…, shishz | Blocked By: | |
| Blocking: | Estimated Completion (week): | ||
| HasPatchForReview: | no | PatchReviewResult: | |
| Reproducible: |
Description
As the title says, the openmoko-mediaplayer isn't able to play Ogg/Vorbis? files.
The files are added corretly to the play list, but if you press play, the mediaplayer only plays a short extract of the track (about the first second, maybe).
ogg123 and mplayer are able to play Ogg/vorbis files (with about 50% CPU usage), if pulseaudio isn't running.
Attachments
Change History
comment:3 in reply to: ↑ 1 Changed 5 years ago by hedora
Two new developments.
First, there's a LOW_MEMORY branch of tremor that might be a better choice for ogg decoding.
Second, telling gstreamer to playback through ALSA results in good performance:
gst-launch -v filesrc location=/media/card/tst.ogg ! oggdemux ! ivorbisdec ! audioconvert ! alsasink
Also, it doesn't seem to interfere with pulseaudio in any meaningful way (the keypad click still works...).
I think that pulseaudio's resampling is using floating point emulation instead of integer aritmetic. It reports:
I: resampler.c: Using resampler 'trivial'
I: resampler.c: Using float32le as working format.
I tricked it into using integer resampling, but that greatly increased CPU load. To help you reproduce, here is a sample pulseaudio + gst session:
Terminal 1:
On the server side, pulseaudio uses floating point to do the resampling.
# /usr/bin/pulseaudio --no-cpu-limit --resample-method=trivial -v -v -v -nF /etc/pulse/session
I: core-util.c: Successfully gained nice level -11.
W: main.c: This program is not intended to be run as root (unless --system is specified).
I: main.c: This is PulseAudio? 0.9.10
I: main.c: Page size is 4096 bytes
I: main.c: Dude, your kernel stinks! The chef's recommendation today is Linux with high-resolution timers enabled!
I: module.c: Loaded "module-esound-protocol-unix" (index: #0; argument: "").
E: socket-server.c: socket(PF_INET6): Address family not supported by protocol
I: module.c: Loaded "module-simple-protocol-tcp" (index: #1; argument: "").
I: protocol-native.c: loading cookie from disk.
I: module.c: Loaded "module-native-protocol-unix" (index: #2; argument: "").
I: module.c: Loaded "module-cli-protocol-unix" (index: #3; argument: "").
E: module.c: Failed to open module "module-x11-bell": module-x11-bell.so: cannot open shared object file: No such file or directory
D: sound-file.c: POSIX_FADV_SEQUENTIAL succeeded.
D: memblock.c: Memory block too large for pool: 1099804 > 16376
D: core-scache.c: Created sample "startup" (#1), 1099804 bytes with sample spec s16le 2ch 44100Hz
D: sound-file.c: POSIX_FADV_SEQUENTIAL succeeded.
D: core-scache.c: Created sample "touchscreen" (#2), 1624 bytes with sample spec s16le 2ch 44100Hz
D: sound-file.c: POSIX_FADV_SEQUENTIAL succeeded.
D: memblock.c: Memory block too large for pool: 850968 > 16376
D: core-scache.c: Created sample "ringtone" (#3), 850968 bytes with sample spec s16le 2ch 44100Hz
E: main.c: Module load failed.
I: module-alsa-sink.c: Successfully opened device default.
I: module-alsa-sink.c: Successfully enabled mmap() mode.
I: alsa-util.c: Successfully attached to mixer 'default'
I: alsa-util.c: Cannot find mixer control "Master".
I: alsa-util.c: Using mixer control "PCM".
I: sink.c: Created sink 0 "output" with sample spec "s16le 2ch 48000Hz"
I: source.c: Created source 0 "output.monitor" with sample spec "s16le 2ch 48000Hz"
I: module-alsa-sink.c: Using 5 fragments of size 4096 bytes.
I: alsa-util.c: All 2 channels can be mapped to mixer channels. Using hardware volume control.
D: module-alsa-sink.c: Thread starting up
D: rtpoll.c: Acquired POSIX realtime signal SIGRTMIN+29
I: module-alsa-sink.c: Starting playback.
I: module.c: Loaded "module-alsa-sink" (index: #4; argument: "sink_name=output").
I: main.c: Daemon startup complete.
I: client.c: Created 0 "Native client (UNIX socket client)"
I: protocol-native.c: Got credentials: uid=0 gid=0 success=1
I: protocol-native.c: Enabled SHM for new connection
I: client.c: Client 0 changed name from "Native client (UNIX socket client)" to "gst-launch-0.10"
I: resampler.c: Using resampler 'trivial'
I: resampler.c: Using float32le as working format.
I: sink-input.c: Created input 0 "Playback Stream" on output with sample spec float32le 2ch 44100Hz and channel map front-left,front-right
D: memblock.c: Memory block too large for pool: 17640 > 16376
D: memblockq.c: memblockq requested: maxlength=141120, tlength=70560, base=8, prebuf=67032, minreq=3528
D: memblockq.c: memblockq sanitized: maxlength=141120, tlength=70560, base=8, prebuf=67032, minreq=3528
Terminal 2:
With pulseaudio, gst converts to floats:
# gst-launch -v filesrc location=/media/card/tst.ogg ! oggdemux ! ivorbisdec !audioconvert ! pulsesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/pipeline0/ivorbisdec0.sink: caps = audio/x-vorbis
/pipeline0/ivorbisdec0.src: caps = audio/x-raw-int, rate=(int)44100, channels=(int)2, endianness=(int)1234, width=(int)32, depth=(int)16, signed=(boolean)true
/pipeline0/audioconvert0.src: caps = audio/x-raw-float, endianness=(int)1234, width=(int)32, rate=(int)44100, channels=(int)2
/pipeline0/audioconvert0.sink: caps = audio/x-raw-int, rate=(int)44100, channels=(int)2, endianness=(int)1234, width=(int)32, depth=(int)16, signed=(boolean)true
/pipeline0/pulsesink0.sink: caps = audio/x-raw-float, endianness=(int)1234, width=(int)32, rate=(int)44100, channels=(int)2
Changed 5 years ago by hedora
- Attachment openmoko-mediaplayer2-performance-workaround.patch added
Use ALSA, not PulseAudio? (haven't tested w/ incoming calls, but touchscreen click and volume control still work)
comment:4 Changed 5 years ago by hedora
I added a patch to tell openmoko-mediplayer2 to use ALSA and not PulseAudio?. So far, this has fixed all of my files, with CPU utilizations between 40-75%. I can even use TangoGPS while listening to music now, though it's a bit sluggish and skips now and then.
I'm not sure how mediaplayer mutes / pauses itself when there's an incoming call. Hopefully it doesn't rely on PulseAudio?. mediaplayer's volume setting and other pulse audio applications continue to work.
There is probably still more work to be done on this bug; CPU utilization is still high enough to interfere with other tasks, and I'm not convinced the current setup is as efficient as it could be.
comment:5 Changed 5 years ago by HdR
Stupid question, but can someone provide a ipk package with this patch added?
I tried, but it seems that I'am unable to do that -.-
Changed 5 years ago by hedora
- Attachment openmoko-mediaplayer2_0.1.0+svnr4173-r4_armv4t.ipk added
See directions below before trying to install.
comment:6 Changed 5 years ago by hedora
I also don't know how to build an ipk package properly. I attached one, but don't expect me to trick it into building a second time. ;)
Also, it produces an md5sum error when you try to install it.
The only way I could override the md5 error was by editing the list of packages downloaded by opkg. I ran the md5sum command on this ipkg, and then replaced the relevant md5 in one of opkg's package databases. The file contains a list of each package, description, etc, and an md5sum.
I can't login to my phone at the moment, and don't remember the name of the package, but you can find it by some combination of
find / | grep opkg
and
strace opkg install [name of ipk file] 2>&1 | grep ^open
Sorry this isn't more helpful. I can't figure out the build system either...
comment:7 Changed 5 years ago by gdevenyi
- Cc ace@… added
- Owner changed from openmoko-devel to tick
- Component changed from unknown to Assassin
comment:8 Changed 5 years ago by gdevenyi
- Owner changed from tick to openmoko-kernel
- Component changed from Assassin to System Software
comment:9 Changed 5 years ago by andy
- Owner changed from openmoko-kernel to julian_chu
- Component changed from System Software to Distro
Sorry, "System Software" is kernel and U-Boot stuff, it doesn't impact on detail of Ogg decoding approach. Sending it back to "Distro" component.
comment:11 Changed 5 years ago by uzi18
- Owner changed from julian_chu to uzi18
- Status changed from new to accepted
hedora: maybe you could provide just tar.gz file?
comment:12 Changed 5 years ago by uzi18
- Owner changed from uzi18 to julian_chu
- Status changed from accepted to assigned
- Component changed from Distro to Assassin
Changed 5 years ago by uzi18
- Attachment openmoko-mediaplayer2_0.1.0_svnr4173-r4_armv4t.tar.gz added
the same as ipk but tar.gz archive
comment:14 Changed 5 years ago by hedora
This is related to bug
comment:15 Changed 5 years ago by uzi18
- Severity changed from normal to critical
but for my gta02 have no sound! mplayer plays well but with mediaplayer i hear silence
comment:16 Changed 5 years ago by chgros
- Summary changed from Mediplayer isn't able to play Ogg/Vorbis files to Mediaplayer isn't able to play Ogg/Vorbis files
comment:17 Changed 5 years ago by hedora
More info from the mailing list:
On 15/08/08 15:20:53, Benito Torres wrote:
On the cpu-hogging: playing mp3s takes constantly ~30% (with and
without
pulseaudio). But mplayer also uses 25%, while in OM2007.2 it was
around
10%. So maybe this is not a mediaplayer-issue but one of the
sound-subsystem?
In FSO just go into the terminal and do "modprobe snd-pcm-oss" and
MPlayer will use less cpu.
Michael.
comment:18 Changed 5 years ago by zecke
- Component changed from Distro to unknown
Important but no distro bug. The mediaplayer should use the autoaudiosink and then people can configure which sink to use... or start optimizing gstreamer.
comment:19 Changed 5 years ago by john_lee
- Owner changed from julian_chu to john_lee
- HasPatchForReview unset
we may switch away from pulseaudio , remove the pulseaudio dependency of om mediaplayer.
comment:20 Changed 5 years ago by john_lee
- Status changed from assigned to closed
- Resolution set to fixed
patch applied in r4750.

I've been looking into this a bit, so here are some things I've figured out so far:
Some ogg files are playable, depending on encoding.
The problem is that the hardware is too slow to play ogg files back with the default configuration. It doesn't have a floating point unit, so things get tricky.
Pulseaudio shouldn't be using much CPU time at all, at least according to this thread (which refers to a different device / os):
http://osdir.com/ml/audio.pulseaudio.general/2007-02/msg00010.html
We probably should figure out what pulseaudio is actually doing, then look into making it simply pass data through. I suspect its acting as a software mixer so that you can change the music volume without changing the touchscreen click volume, but need to confirm this.
I've been trying to figure out where the gst-plugin-vorbisi file's source code lives for further debugging, but I've been busy and it's been slow going. I've managed to find the source code for gst-plugin-vorbis, but that one uses floating point math, and is slower than the one shipped on the phone.
Beyond fixing the pulseaudio overhead by getting it to stop doing software mixing / resampling / ???, there are some other things that could help:
Also, have you been able to tell if ogg123/mplayer are using libvorbis, or libvorbisi? I've been meaning to check, since if they're using floating point emulation, we should have plenty of cycles to spare...
-Rusty