mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
Try to fix timestamps (step 1). Looks OK on H55.
This commit is contained in:
parent
cf29e752de
commit
ecff33db03
3 changed files with 17 additions and 6 deletions
|
@ -195,7 +195,11 @@ destroy_surface(DecodedSurface *ds)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
push_surface(GstVaapiDecoder *decoder, GstVaapiSurface *surface)
|
push_surface(
|
||||||
|
GstVaapiDecoder *decoder,
|
||||||
|
GstVaapiSurface *surface,
|
||||||
|
GstClockTime timestamp
|
||||||
|
)
|
||||||
{
|
{
|
||||||
GstVaapiDecoderPrivate * const priv = decoder->priv;
|
GstVaapiDecoderPrivate * const priv = decoder->priv;
|
||||||
DecodedSurface *ds;
|
DecodedSurface *ds;
|
||||||
|
@ -209,7 +213,7 @@ push_surface(GstVaapiDecoder *decoder, GstVaapiSurface *surface)
|
||||||
ds->proxy = gst_vaapi_surface_proxy_new(priv->context, surface);
|
ds->proxy = gst_vaapi_surface_proxy_new(priv->context, surface);
|
||||||
if (ds->proxy) {
|
if (ds->proxy) {
|
||||||
ds->status = GST_VAAPI_DECODER_STATUS_SUCCESS;
|
ds->status = GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||||
gst_vaapi_surface_proxy_set_timestamp(ds->proxy, priv->surface_timestamp);
|
gst_vaapi_surface_proxy_set_timestamp(ds->proxy, timestamp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ds->status = GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
|
ds->status = GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
|
||||||
|
@ -586,8 +590,9 @@ gst_vaapi_decoder_ensure_context(
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_decoder_push_surface(
|
gst_vaapi_decoder_push_surface(
|
||||||
GstVaapiDecoder *decoder,
|
GstVaapiDecoder *decoder,
|
||||||
GstVaapiSurface *surface
|
GstVaapiSurface *surface,
|
||||||
|
GstClockTime timestamp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return push_surface(decoder, surface);
|
return push_surface(decoder, surface, timestamp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ struct _GstVaapiContextFfmpeg {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstVaapiDecoderFfmpegPrivate {
|
struct _GstVaapiDecoderFfmpegPrivate {
|
||||||
|
GstClockTime in_timestamp; /* timestamp from the demuxer */
|
||||||
AVFrame *frame;
|
AVFrame *frame;
|
||||||
AVCodecParserContext *pctx;
|
AVCodecParserContext *pctx;
|
||||||
AVCodecContext *avctx;
|
AVCodecContext *avctx;
|
||||||
|
@ -233,6 +234,7 @@ gst_vaapi_decoder_ffmpeg_get_format(AVCodecContext *avctx, const enum PixelForma
|
||||||
static int
|
static int
|
||||||
gst_vaapi_decoder_ffmpeg_get_buffer(AVCodecContext *avctx, AVFrame *pic)
|
gst_vaapi_decoder_ffmpeg_get_buffer(AVCodecContext *avctx, AVFrame *pic)
|
||||||
{
|
{
|
||||||
|
GstVaapiContextFfmpeg * const vactx = avctx->hwaccel_context;
|
||||||
GstVaapiContext *context;
|
GstVaapiContext *context;
|
||||||
GstVaapiSurface *surface;
|
GstVaapiSurface *surface;
|
||||||
GstVaapiID surface_id;
|
GstVaapiID surface_id;
|
||||||
|
@ -260,6 +262,7 @@ gst_vaapi_decoder_ffmpeg_get_buffer(AVCodecContext *avctx, AVFrame *pic)
|
||||||
pic->linesize[1] = 0;
|
pic->linesize[1] = 0;
|
||||||
pic->linesize[2] = 0;
|
pic->linesize[2] = 0;
|
||||||
pic->linesize[3] = 0;
|
pic->linesize[3] = 0;
|
||||||
|
pic->pts = vactx->decoder->priv->in_timestamp;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +449,7 @@ decode_frame(GstVaapiDecoderFfmpeg *ffdecoder, guchar *buf, guint buf_size)
|
||||||
if (!surface)
|
if (!surface)
|
||||||
return GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE;
|
return GST_VAAPI_DECODER_STATUS_ERROR_INVALID_SURFACE;
|
||||||
|
|
||||||
gst_vaapi_decoder_push_surface(GST_VAAPI_DECODER_CAST(ffdecoder), surface);
|
gst_vaapi_decoder_push_surface(GST_VAAPI_DECODER_CAST(ffdecoder), surface, priv->frame->pts);
|
||||||
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,6 +492,7 @@ gst_vaapi_decoder_ffmpeg_decode(GstVaapiDecoder *decoder, GstBuffer *buffer)
|
||||||
inbuf_size -= parsed_size;
|
inbuf_size -= parsed_size;
|
||||||
}
|
}
|
||||||
} while (!got_frame && inbuf_size > 0);
|
} while (!got_frame && inbuf_size > 0);
|
||||||
|
inbuf_ts = priv->pctx->pts;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
outbuf = inbuf;
|
outbuf = inbuf;
|
||||||
|
@ -499,6 +503,7 @@ gst_vaapi_decoder_ffmpeg_decode(GstVaapiDecoder *decoder, GstBuffer *buffer)
|
||||||
if (!got_frame && !GST_BUFFER_IS_EOS(buffer))
|
if (!got_frame && !GST_BUFFER_IS_EOS(buffer))
|
||||||
return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;
|
return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;
|
||||||
|
|
||||||
|
priv->in_timestamp = inbuf_ts;
|
||||||
return decode_frame(ffdecoder, outbuf, outbuf_size);
|
return decode_frame(ffdecoder, outbuf, outbuf_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,8 @@ gst_vaapi_decoder_ensure_context(
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_decoder_push_surface(
|
gst_vaapi_decoder_push_surface(
|
||||||
GstVaapiDecoder *decoder,
|
GstVaapiDecoder *decoder,
|
||||||
GstVaapiSurface *surface
|
GstVaapiSurface *surface,
|
||||||
|
GstClockTime timestamp
|
||||||
) attribute_hidden;
|
) attribute_hidden;
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
Loading…
Reference in a new issue