speed: Fix some bytes-per-frame vs. bytes-per-sample mixups

Otherwise we will crash when handling multiple channels and
miscalculate timestamps.

https://bugzilla.gnome.org/show_bug.cgi?id=709734
This commit is contained in:
Sebastian Dröge 2013-10-09 17:18:41 +02:00
parent f16e70e4ca
commit f0b5d84c54

View file

@ -594,7 +594,7 @@ speed_chain (GstPad * pad, GstObject * parent, GstBuffer * in_buf)
out_buf = gst_buffer_new_and_alloc (out_size); out_buf = gst_buffer_new_and_alloc (out_size);
in_samples = gst_buffer_get_size (in_buf) / in_samples = gst_buffer_get_size (in_buf) /
GST_AUDIO_INFO_BPS (&filter->info); GST_AUDIO_INFO_BPF (&filter->info);
out_samples = 0; out_samples = 0;
@ -606,13 +606,13 @@ speed_chain (GstPad * pad, GstObject * parent, GstBuffer * in_buf)
speed_chain_float32 (filter, in_buf, out_buf, c, in_samples); speed_chain_float32 (filter, in_buf, out_buf, c, in_samples);
} }
size = out_samples * GST_AUDIO_INFO_BPS (&filter->info); size = out_samples * GST_AUDIO_INFO_BPF (&filter->info);
gst_buffer_set_size (out_buf, size); gst_buffer_set_size (out_buf, size);
GST_BUFFER_OFFSET (out_buf) = filter->offset; GST_BUFFER_OFFSET (out_buf) = filter->offset;
GST_BUFFER_TIMESTAMP (out_buf) = filter->timestamp; GST_BUFFER_TIMESTAMP (out_buf) = filter->timestamp;
filter->offset += size / GST_AUDIO_INFO_BPS (&filter->info); filter->offset += size / GST_AUDIO_INFO_BPF (&filter->info);
filter->timestamp = gst_util_uint64_scale_int (filter->offset, GST_SECOND, filter->timestamp = gst_util_uint64_scale_int (filter->offset, GST_SECOND,
GST_AUDIO_INFO_RATE (&filter->info)); GST_AUDIO_INFO_RATE (&filter->info));