mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 07:28:53 +00:00
ext/vorbis/vorbisenc.c: Report the encoder latency. Fixes #538232.
Original commit message from CVS: * ext/vorbis/vorbisenc.c: (gst_vorbis_enc_get_latency), (gst_vorbis_enc_src_query), (gst_vorbis_enc_chain): Report the encoder latency. Fixes #538232.
This commit is contained in:
parent
cf7da52701
commit
5ff8a9437e
2 changed files with 38 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2008-06-20 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
|
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_get_latency),
|
||||||
|
(gst_vorbis_enc_src_query), (gst_vorbis_enc_chain):
|
||||||
|
Report the encoder latency. Fixes #538232.
|
||||||
|
|
||||||
2008-06-20 Wim Taymans <wim.taymans@collabora.co.uk>
|
2008-06-20 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
* gst/playback/gstplaybin2.c: (gst_play_bin_get_property),
|
* gst/playback/gstplaybin2.c: (gst_play_bin_get_property),
|
||||||
|
|
|
@ -491,6 +491,15 @@ gst_vorbis_enc_convert_sink (GstPad * pad, GstFormat src_format,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gint64
|
||||||
|
gst_vorbis_enc_get_latency (GstVorbisEnc * vorbisenc)
|
||||||
|
{
|
||||||
|
/* FIXME, this probably depends on the bitrate and other setting but for now
|
||||||
|
* we return this value, which was obtained by totally unscientific
|
||||||
|
* measurements */
|
||||||
|
return 58 * GST_MSECOND;
|
||||||
|
}
|
||||||
|
|
||||||
static const GstQueryType *
|
static const GstQueryType *
|
||||||
gst_vorbis_enc_get_query_types (GstPad * pad)
|
gst_vorbis_enc_get_query_types (GstPad * pad)
|
||||||
{
|
{
|
||||||
|
@ -568,8 +577,28 @@ gst_vorbis_enc_src_query (GstPad * pad, GstQuery * query)
|
||||||
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GST_QUERY_LATENCY:
|
||||||
|
{
|
||||||
|
gboolean live;
|
||||||
|
GstClockTime min_latency, max_latency;
|
||||||
|
gint64 latency;
|
||||||
|
|
||||||
|
if ((res = gst_pad_query (peerpad, query))) {
|
||||||
|
gst_query_parse_latency (query, &live, &min_latency, &max_latency);
|
||||||
|
|
||||||
|
latency = gst_vorbis_enc_get_latency (vorbisenc);
|
||||||
|
|
||||||
|
/* add our latency */
|
||||||
|
min_latency += latency;
|
||||||
|
if (max_latency != -1)
|
||||||
|
max_latency += latency;
|
||||||
|
|
||||||
|
gst_query_set_latency (query, live, min_latency, max_latency);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
res = gst_pad_query_default (pad, query);
|
res = gst_pad_query (peerpad, query);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1198,6 +1227,8 @@ gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
/* tell the library how much we actually submitted */
|
/* tell the library how much we actually submitted */
|
||||||
vorbis_analysis_wrote (&vorbisenc->vd, size);
|
vorbis_analysis_wrote (&vorbisenc->vd, size);
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (vorbisenc, "wrote %lu samples to vorbis", size);
|
||||||
|
|
||||||
vorbisenc->samples_in += size;
|
vorbisenc->samples_in += size;
|
||||||
|
|
||||||
gst_buffer_unref (buffer);
|
gst_buffer_unref (buffer);
|
||||||
|
|
Loading…
Reference in a new issue