mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
ext/mad/gstmad.c: Fix inconsistent use of rate and channels.
Original commit message from CVS: * ext/mad/gstmad.c: (gst_mad_convert_src), (gst_mad_chain): Fix inconsistent use of rate and channels. Fixes #533581
This commit is contained in:
parent
a40deba0ce
commit
6385946841
2 changed files with 13 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2008-05-19 Edward Hervey <edward.hervey@collabora.co.uk>
|
||||||
|
|
||||||
|
* ext/mad/gstmad.c: (gst_mad_convert_src), (gst_mad_chain):
|
||||||
|
Fix inconsistent use of rate and channels.
|
||||||
|
Fixes #533581
|
||||||
|
|
||||||
2008-05-19 Wim Taymans <wim.taymans@collabora.co.uk>
|
2008-05-19 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
* gst/realmedia/rmdemux.c: (gst_rmdemux_send_event):
|
* gst/realmedia/rmdemux.c: (gst_rmdemux_send_event):
|
||||||
|
|
|
@ -384,7 +384,7 @@ gst_mad_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value,
|
||||||
|
|
||||||
mad = GST_MAD (GST_PAD_PARENT (pad));
|
mad = GST_MAD (GST_PAD_PARENT (pad));
|
||||||
|
|
||||||
bytes_per_sample = MAD_NCHANNELS (&mad->frame.header) * 4;
|
bytes_per_sample = mad->channels * 4;
|
||||||
|
|
||||||
switch (src_format) {
|
switch (src_format) {
|
||||||
case GST_FORMAT_BYTES:
|
case GST_FORMAT_BYTES:
|
||||||
|
@ -396,7 +396,7 @@ gst_mad_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value,
|
||||||
break;
|
break;
|
||||||
case GST_FORMAT_TIME:
|
case GST_FORMAT_TIME:
|
||||||
{
|
{
|
||||||
gint byterate = bytes_per_sample * mad->frame.header.samplerate;
|
gint byterate = bytes_per_sample * mad->rate;
|
||||||
|
|
||||||
if (byterate == 0)
|
if (byterate == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -414,10 +414,10 @@ gst_mad_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value,
|
||||||
*dest_value = src_value * bytes_per_sample;
|
*dest_value = src_value * bytes_per_sample;
|
||||||
break;
|
break;
|
||||||
case GST_FORMAT_TIME:
|
case GST_FORMAT_TIME:
|
||||||
if (mad->frame.header.samplerate == 0)
|
if (mad->rate == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
*dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND,
|
*dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND,
|
||||||
mad->frame.header.samplerate);
|
mad->rate);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
|
@ -430,7 +430,7 @@ gst_mad_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value,
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case GST_FORMAT_DEFAULT:
|
case GST_FORMAT_DEFAULT:
|
||||||
*dest_value = gst_util_uint64_scale_int (src_value,
|
*dest_value = gst_util_uint64_scale_int (src_value,
|
||||||
scale * mad->frame.header.samplerate, GST_SECOND);
|
scale * mad->rate, GST_SECOND);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
|
@ -1482,9 +1482,8 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
nsamples = MAD_NSBSAMPLES (&mad->frame.header) *
|
nsamples = MAD_NSBSAMPLES (&mad->frame.header) *
|
||||||
(mad->stream.options & MAD_OPTION_HALFSAMPLERATE ? 16 : 32);
|
(mad->stream.options & MAD_OPTION_HALFSAMPLERATE ? 16 : 32);
|
||||||
|
|
||||||
if (mad->frame.header.samplerate == 0) {
|
if (mad->rate == 0) {
|
||||||
g_warning
|
g_warning ("mad->rate is 0; timestamps cannot be calculated");
|
||||||
("mad->frame.header.samplerate is 0; timestamps cannot be calculated");
|
|
||||||
} else {
|
} else {
|
||||||
/* if we have a pending timestamp, we can use it now to calculate the sample offset */
|
/* if we have a pending timestamp, we can use it now to calculate the sample offset */
|
||||||
if (GST_CLOCK_TIME_IS_VALID (mad->last_ts)) {
|
if (GST_CLOCK_TIME_IS_VALID (mad->last_ts)) {
|
||||||
|
|
Loading…
Reference in a new issue