mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
ext/x264/gstx264enc.*: Do not deal with duplicated input (timestamps). If needed, a generic element can do so.
Original commit message from CVS: * ext/x264/gstx264enc.c: (gst_x264_enc_reset), (gst_x264_enc_chain), (gst_x264_enc_encode_frame): * ext/x264/gstx264enc.h: Do not deal with duplicated input (timestamps). If needed, a generic element can do so. Do not manipulate input timestamps on the way out, since that shifts the timeline and A/V sync.
This commit is contained in:
parent
de2f30c7d4
commit
601b0f1d96
3 changed files with 14 additions and 26 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2008-08-12 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
|
||||||
|
|
||||||
|
* ext/x264/gstx264enc.c: (gst_x264_enc_reset),
|
||||||
|
(gst_x264_enc_chain), (gst_x264_enc_encode_frame):
|
||||||
|
* ext/x264/gstx264enc.h:
|
||||||
|
Do not deal with duplicated input (timestamps). If needed,
|
||||||
|
a generic element can do so.
|
||||||
|
Do not manipulate input timestamps on the way out,
|
||||||
|
since that shifts the timeline and A/V sync.
|
||||||
|
|
||||||
2008-08-12 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
|
2008-08-12 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
|
||||||
|
|
||||||
* docs/plugins/gst-plugins-bad-plugins.args:
|
* docs/plugins/gst-plugins-bad-plugins.args:
|
||||||
|
|
|
@ -466,7 +466,6 @@ gst_x264_enc_reset (GstX264Enc * encoder)
|
||||||
encoder->x264enc = NULL;
|
encoder->x264enc = NULL;
|
||||||
encoder->width = 0;
|
encoder->width = 0;
|
||||||
encoder->height = 0;
|
encoder->height = 0;
|
||||||
encoder->last_timestamp = GST_CLOCK_TIME_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -840,22 +839,6 @@ gst_x264_enc_chain (GstPad * pad, GstBuffer * buf)
|
||||||
if (G_UNLIKELY (GST_BUFFER_SIZE (buf) < encoder->image_size))
|
if (G_UNLIKELY (GST_BUFFER_SIZE (buf) < encoder->image_size))
|
||||||
goto wrong_buffer_size;
|
goto wrong_buffer_size;
|
||||||
|
|
||||||
/* ignore duplicated packets */
|
|
||||||
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf))) {
|
|
||||||
if (GST_CLOCK_TIME_IS_VALID (encoder->last_timestamp)) {
|
|
||||||
GstClockTimeDiff diff =
|
|
||||||
GST_BUFFER_TIMESTAMP (buf) - encoder->last_timestamp;
|
|
||||||
if (diff <= 0) {
|
|
||||||
GST_ELEMENT_WARNING (encoder, STREAM, ENCODE,
|
|
||||||
("Duplicated packet in input, dropping"),
|
|
||||||
("Time difference was -%" GST_TIME_FORMAT, GST_TIME_ARGS (-diff)));
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
return GST_FLOW_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
encoder->last_timestamp = GST_BUFFER_TIMESTAMP (buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remember the timestamp and duration */
|
/* remember the timestamp and duration */
|
||||||
g_queue_push_tail (encoder->delay, buf);
|
g_queue_push_tail (encoder->delay, buf);
|
||||||
|
|
||||||
|
@ -969,14 +952,11 @@ gst_x264_enc_encode_frame (GstX264Enc * encoder, x264_picture_t * pic_in,
|
||||||
GST_BUFFER_SIZE (out_buf) = i_size;
|
GST_BUFFER_SIZE (out_buf) = i_size;
|
||||||
|
|
||||||
/* PTS */
|
/* PTS */
|
||||||
|
/* FIXME ??: maybe use DTS here, since:
|
||||||
|
* - it is so practiced by other encoders,
|
||||||
|
* - downstream (e.g. muxers) might not enjoy non-monotone timestamps,
|
||||||
|
* whereas a decoder can also deal with DTS */
|
||||||
GST_BUFFER_TIMESTAMP (out_buf) = pic_out.i_pts;
|
GST_BUFFER_TIMESTAMP (out_buf) = pic_out.i_pts;
|
||||||
if (encoder->x264param.i_bframe) {
|
|
||||||
/* When using B-frames, the frames will be reordered.
|
|
||||||
Make PTS start one frame after DTS. */
|
|
||||||
GST_BUFFER_TIMESTAMP (out_buf)
|
|
||||||
+= GST_SECOND * encoder->fps_den / encoder->fps_num;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_BUFFER_DURATION (out_buf) = duration;
|
GST_BUFFER_DURATION (out_buf) = duration;
|
||||||
|
|
||||||
if (pic_out.i_type == X264_TYPE_IDR) {
|
if (pic_out.i_type == X264_TYPE_IDR) {
|
||||||
|
|
|
@ -94,8 +94,6 @@ struct _GstX264Enc
|
||||||
/* for b-frame delay handling */
|
/* for b-frame delay handling */
|
||||||
GQueue *delay;
|
GQueue *delay;
|
||||||
|
|
||||||
GstClockTime last_timestamp;
|
|
||||||
|
|
||||||
guint8 *buffer;
|
guint8 *buffer;
|
||||||
gulong buffer_size;
|
gulong buffer_size;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue