After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 485462 - alsaspdifsink uses wrong sample rate
alsaspdifsink uses wrong sample rate
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
0.10.14
Other Linux
: Normal major
: 0.10.6
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-10-10 17:36 UTC by Michael Kötter
Modified: 2007-11-15 18:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
output of gst-launch with GST_DEBUG=*sink*:5 (559.60 KB, text/plain)
2007-10-10 17:38 UTC, Michael Kötter
  Details
output of gst-launch with GST_DEBUG=*sink*:5,*ring*:5 (190.65 KB, text/plain)
2007-10-11 13:09 UTC, Michael Kötter
  Details
output of gst-launch with GST_DEBUG=*sink*:5,*ring*:5 GST_DEBUG_NO_COLOR=1 (74.85 KB, text/plain)
2007-10-11 13:49 UTC, Michael Kötter
  Details
sets the correct rate (5.06 KB, patch)
2007-10-11 19:17 UTC, Michael Kötter
none Details | Review
set correct sample rate, fix clock issues, remove some hw params (7.20 KB, patch)
2007-10-14 15:43 UTC, Michael Kötter
committed Details | Review
output of a simple pyGst player (audio/video) with GST_DEBUG=*sink*:5 (967.70 KB, text/plain)
2007-10-14 16:11 UTC, Michael Kötter
  Details
output of a simple pyGst player, with fakesink for audio (688.65 KB, text/plain)
2007-10-14 16:25 UTC, Michael Kötter
  Details

Description Michael Kötter 2007-10-10 17:36:39 UTC
When using the following pipeline:

gst-launch-0.10 filesrc location=ac3-sample.avi ! decodebin2 caps=audio/x-ac3 ! ac3iec958 ! alsaspdifsink

the output on the S/PDIF is using a wrong sample rate of 44100 Hz (should be 48000). All pads show the correct rate 48KHz, but the AVR shows 44.1KHz and sound is slowed down.

On the same system I can play the file using xine or mplayer without problems.
Comment 1 Michael Kötter 2007-10-10 17:38:18 UTC
Created attachment 97013 [details]
output of gst-launch with GST_DEBUG=*sink*:5
Comment 2 Wim Taymans 2007-10-11 10:40:59 UTC
sorry, can you make a log with:

GST_DEBUG=*sink*:5,*ring*:5

please. This one does not show the samplerate as negotiated with the sink.
Comment 3 Michael Kötter 2007-10-11 13:09:51 UTC
Created attachment 97056 [details]
output of gst-launch with GST_DEBUG=*sink*:5,*ring*:5

sure, here it is - although I'm not sure if it is what you need, from looking at it I can't find additional info?
Comment 4 Michael Kötter 2007-10-11 13:17:28 UTC
I just looked at alsaspdifsink.c and discovered that the ALSA PCM sample rate is only set in alsaspdifsink_open, which happens very early (you can see that in the log when it prints "Generated device string...").
Perhaps the caps containing the actual sample rate get set later, but the ALSA PCM sample rate never gets updated?

I'll try to verify this once I'm home.
Comment 5 Michael Kötter 2007-10-11 13:49:52 UTC
Created attachment 97060 [details]
output of gst-launch with GST_DEBUG=*sink*:5,*ring*:5 GST_DEBUG_NO_COLOR=1

just found out about the GST_DEBUG_NO_COLOR flag :)
Comment 6 Michael Kötter 2007-10-11 19:17:53 UTC
Created attachment 97081 [details] [review]
sets the correct rate

This works for me, it sets all ALSA parameters (incl. rate) when the caps have changed.
Comment 7 Michael Kötter 2007-10-14 15:43:30 UTC
Created attachment 97211 [details] [review]
set correct sample rate, fix clock issues, remove some hw params

In addition to the sample rate fix, this is an attempt to fix the clock. It should now at least return reasonable values.

Also, I removed some hardware params (buffer_time, period_time). These broke output on my Audiophile 24/96 (ICE1712) - without them, it works.
Tested with ICE1712 and AD198x (Intel HDA).
Comment 8 Michael Kötter 2007-10-14 16:11:37 UTC
Created attachment 97213 [details]
output of a simple pyGst player (audio/video) with GST_DEBUG=*sink*:5

Log from a simple pyGst test player.
One issue remaining: video has some kind of "micro-stutter", it looks like every 20th video frame or so gets dropped or delayed.
Comment 9 Michael Kötter 2007-10-14 16:25:29 UTC
Created attachment 97214 [details]
output of a simple pyGst player, with fakesink for audio
Comment 10 Wim Taymans 2007-11-15 18:41:47 UTC
        Patch by: Michael Kötter <m dot koetter at oraise dot de>

        * ext/alsaspdif/alsaspdifsink.c: (alsaspdifsink_set_caps),
        (alsaspdifsink_get_time), (alsaspdifsink_open),
        (alsaspdifsink_set_params), (alsaspdifsink_delay), (plugin_init):
        Fix sample rate and clocking.
        Remove buffer_time and period_time as this seems to break on some
        hardware. Fixes #485462.