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 318273 - [audioscale] messed up timestamps
[audioscale] messed up timestamps
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins
0.8.x
Other All
: Normal major
: 0.8.12
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-10-08 11:10 UTC by Jonathon Conte
Modified: 2005-10-31 10:31 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
example of a file that will not play correctly (88.65 KB, audio/x-wav)
2005-10-10 07:06 UTC, Jonathon Conte
  Details
patch 1 (771 bytes, patch)
2005-10-14 19:18 UTC, Luca Ognibene
committed Details | Review

Description Jonathon Conte 2005-10-08 11:10:22 UTC
Please describe the problem:
When using gstreamer to play voicemails in wav format (stored locally), the
audio output sounds choppy and incomprehensible. The wav files are in the
following format:

RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz

The same files can be played flawlessly using beep-media-player so I do not
think that the files are corrupt (although I would be happy to test them if
someone could suggest a utility for verifying wav files).

Steps to reproduce:
1. 
2. 
3. 


Actual results:


Expected results:


Does this happen every time?
I have no trouble playing other audio formats with gstreamer including wav files
that are of the following type:

RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz

Other information:
I'm running gstreamer 0.8.11 in Ubuntu Breezy.
Comment 1 Tim-Philipp Müller 2005-10-08 11:35:20 UTC
How do you play them using GStreamer? Is that with rhythmbox, totem, jamboree,
some other player?

What audio sink are you using?

Does this work?

 % gst-launch-0.8 filesrc location=/path/to/foo.wav ! decodebin ! audioconvert !
audioscale ! alsasink 

(replace alsasink with esdsink or osssink or whatever you are using).

or this:

 % gst-launch-0.8 filesrc location=/path/to/foo.wav ! decodebin ! audioconvert !
audioscale ! gconfaudiosink


If you use alsasink, can you also try this:

 % gst-launch-0.8 filesrc location=/path/to/foo.wav ! decodebin ! audioconvert !
audioscale ! alsasink device=hw:0

Cheers
 -Tim

Comment 2 Jonathon Conte 2005-10-08 18:37:30 UTC
At first I tried to play the wav with the (unmodified) playbin example from the
gstreamer documenation. When it didn't work I figured that there was something
wrong with the code but then I tried another audio app and I had the same
results. I tried using the playbin example code for other audio types and they
all played perfectly so it seems as if gstreamer is having a problem
detecting/decoding this particualar type of wav.

When I try your gst-launch-0.8 example above I get the following error message:

RUNNING pipeline ...
Execution ended after 40 iterations (sum 2393549000 ns, average 59838725 ns, min
113000 ns, max 237773000 ns)
Comment 3 Jonathon Conte 2005-10-10 07:06:31 UTC
Created attachment 53270 [details]
example of a file that will not play correctly
Comment 4 Tim-Philipp Müller 2005-10-10 11:14:59 UTC
Thanks for the sample file.


In 0.8 it plays fine for me with osssink, but not with alsasink. In my setup it
turns out that the reason is that audioscale timestamps buffers wrongly (with
osssink audioscale just does pass-through, whereas for alsasink it has to
resample to 48000 for me).

Also plays fine with both alsasink and osssink in 0.9.



This is timestamping with audioscale in passthrough mode:

 % gst-launch-0.8 -v filesrc location=pcm-mono-8kHz-bug318273.wav ! wavparse !
audioconvert ! audioscale ! 'audio/x-raw-int, rate=(int)8000, channels=(int)2,
endianness=(int)1234, width=(int)16, depth=(int)16' ! fakesink

timestamp: 0:00:00.000000000, duration: 0:00:00.256000000, offset: 44
timestamp: 0:00:00.256000000, duration: 0:00:00.256000000, offset: 4140
timestamp: 0:00:00.512000000, duration: 0:00:00.256000000, offset: 8236
timestamp: 0:00:00.768000000, duration: 0:00:00.256000000, offset: 12332
timestamp: 0:00:01.024000000, duration: 0:00:00.256000000, offset: 16428
timestamp: 0:00:01.280000000, duration: 0:00:00.256000000, offset: 20524
timestamp: 0:00:01.536000000, duration: 0:00:00.256000000, offset: 24620
timestamp: 0:00:01.792000000, duration: 0:00:00.256000000, offset: 28716
timestamp: 0:00:02.048000000, duration: 0:00:00.256000000, offset: 32812
timestamp: 0:00:02.304000000, duration: 0:00:00.256000000, offset: 36908
timestamp: 0:00:02.560000000, duration: 0:00:00.256000000, offset: 41004
timestamp: 0:00:02.816000000, duration: 0:00:00.256000000, offset: 45100
timestamp: 0:00:03.072000000, duration: 0:00:00.256000000, offset: 49196
timestamp: 0:00:03.328000000, duration: 0:00:00.256000000, offset: 53292
timestamp: 0:00:03.584000000, duration: 0:00:00.256000000, offset: 57388
timestamp: 0:00:03.840000000, duration: 0:00:00.256000000, offset: 61484
timestamp: 0:00:04.096000000, duration: 0:00:00.256000000, offset: 65580
timestamp: 0:00:04.352000000, duration: 0:00:00.256000000, offset: 69676
timestamp: 0:00:04.608000000, duration: 0:00:00.256000000, offset: 73772
timestamp: 0:00:04.864000000, duration: 0:00:00.256000000, offset: 77868
timestamp: 0:00:05.120000000, duration: 0:00:00.256000000, offset: 81964
timestamp: 0:00:05.376000000, duration: 0:00:00.256000000, offset: 86060
timestamp: 0:00:05.632000000, duration: 0:00:00.035250000, offset: 90156


This is timestamping with audioscale doing resampling:

 % gst-launch-0.8 -v filesrc location=pcm-mono-8kHz-bug318273.wav ! wavparse !
audioconvert ! audioscale ! 'audio/x-raw-int, rate=(int)48000, channels=(int)2,
endianness=(int)1234, width=(int)16, depth=(int)16' ! fakesink 

timestamp: 0:00:00.000000000, duration: 0:00:00.063748980, offset: -1
timestamp: 0:00:00.063748980, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:00.127747956, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:00.191746932, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:00.255745908, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:00.319744884, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:00.383743860, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:00.447742836, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:00.511741812, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:00.575740788, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:00.639739764, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:00.703738740, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:00.767737716, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:00.831736692, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:00.895735668, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:00.959734644, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:01.023733620, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:01.087732596, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:01.151731572, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:01.215730548, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:01.279729524, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:01.343728500, duration: 0:00:00.063998976, offset: -1
timestamp: 0:00:01.407727476, duration: 0:00:00.008812359, offset: -1


I wonder if this is also the cause for quite a few of the 'this files sounds
crap in alsasink' problems we're having.

Cheers
 -Tim
Comment 5 Luca Ognibene 2005-10-10 18:54:51 UTC
But these work fine (at least here):

gst-launch-0.8 filesrc location="a.wav" ! wavparse ! audioconvert ! identity !
audioscale ! audio/x-raw-int, rate=44000 ! osssink

a) convert it to 44000 and then encode it:
/usr/local/bin/gst-launch-0.8 filesrc location="a.wav" ! wavparse ! audioconvert
! identity ! audioscale ! audio/x-raw-int, rate=44000 ! wavenc ! filesink
location="a2.wav
b) enjoy:
gst-launch-0.8 filesrc location="a2.wav" ! wavparse ! alsasink device="hw:0"

/usr/local/bin/gst-launch-0.8 filesrc location="a.wav" ! wavparse ! audioconvert
! identity ! audioscale ! audio/x-raw-int, rate=44000 ! wavenc ! wavparse !
alsasink device="hw:0"

but maybe i'm just totally wrong.. :) don't know much about audio.
Comment 6 Christian Kirbach 2005-10-13 15:07:23 UTC
*** Bug 318767 has been marked as a duplicate of this bug. ***
Comment 7 Christian Kirbach 2005-10-13 15:09:06 UTC
this can also happen with certain .mp3 files using alsasink
Comment 8 Luca Ognibene 2005-10-14 19:18:21 UTC
Created attachment 53490 [details] [review]
patch 1

Proposed patch..
This makes it works for me (tm)
Comment 9 Christian Kirbach 2005-10-16 21:39:11 UTC
Hmm, no difference here.... patch has no effect.
Comment 10 Luca Ognibene 2005-10-23 15:25:27 UTC
On the wav or the mp3 file ?
Comment 11 Christian Kirbach 2005-10-23 15:54:33 UTC
the mp3 file still plays choppy for me with the patch applied. Works fine with 
e.g. osssink
Comment 12 Luca Ognibene 2005-10-23 15:59:06 UTC
and the wav file? Can you please put the mp3 file somewhere? (can't find it at
your link). 
Tim ? any comment ?
Comment 13 Tim-Philipp Müller 2005-10-23 16:19:33 UTC
The patch looks good to me and fixes the original problem, please apply it.

I'll re-open the other bug then, as there still seem to be problems with
alsasink that need to be fixed also.

Cheers
 -Tim
Comment 14 Tim-Philipp Müller 2005-10-31 10:29:30 UTC
Committed to 0.8 branch:

2005-10-31  Luca Ognibene  <luogni@tin.it>

       Reviewed by: Tim-Philipp Muller  <tim at centricular dot net>

       * gst/audioscale/gstaudioscale.c: (gst_audioscale_link):
         Don't mess up timestamps and durations when resampling
         by more than a factor of 2 (e.g. 8kHz => 48kHz) (#318273).

Cheers
 -Tim