mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
codecs: vp9decoder: Use GstFlowReturn everywhere
The same modification as that of VP8 decoder Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2528>
This commit is contained in:
parent
aaeb76f09c
commit
e009e80178
5 changed files with 107 additions and 77 deletions
|
@ -144,12 +144,12 @@ gst_vp9_decoder_stop (GstVideoDecoder * decoder)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_vp9_decoder_check_codec_change (GstVp9Decoder * self,
|
||||
const GstVp9FrameHeader * frame_hdr)
|
||||
{
|
||||
GstVp9DecoderPrivate *priv = self->priv;
|
||||
gboolean ret = TRUE;
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
gboolean changed = FALSE;
|
||||
|
||||
if (priv->width != frame_hdr->width || priv->height != frame_hdr->height) {
|
||||
|
@ -171,9 +171,10 @@ gst_vp9_decoder_check_codec_change (GstVp9Decoder * self,
|
|||
|
||||
priv->had_sequence = TRUE;
|
||||
if (klass->new_sequence)
|
||||
priv->had_sequence = klass->new_sequence (self, frame_hdr);
|
||||
ret = klass->new_sequence (self, frame_hdr);
|
||||
|
||||
ret = priv->had_sequence;
|
||||
if (ret != GST_FLOW_OK)
|
||||
priv->had_sequence = FALSE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -298,10 +299,12 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder,
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
if (check_codec_change &&
|
||||
!gst_vp9_decoder_check_codec_change (self, &frame_hdr)) {
|
||||
GST_ERROR_OBJECT (self, "codec change error");
|
||||
goto unmap_and_error;
|
||||
if (check_codec_change) {
|
||||
ret = gst_vp9_decoder_check_codec_change (self, &frame_hdr);
|
||||
if (ret != GST_FLOW_OK) {
|
||||
GST_WARNING_OBJECT (self, "Subclass cannot handle codec change");
|
||||
goto unmap_and_error;
|
||||
}
|
||||
}
|
||||
|
||||
if (!priv->had_sequence) {
|
||||
|
@ -346,29 +349,33 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder,
|
|||
picture->size = map.size;
|
||||
|
||||
if (klass->new_picture) {
|
||||
if (!klass->new_picture (self, frame, picture)) {
|
||||
GST_ERROR_OBJECT (self, "new picture error");
|
||||
ret = klass->new_picture (self, frame, picture);
|
||||
if (ret != GST_FLOW_OK) {
|
||||
GST_WARNING_OBJECT (self, "subclass failed to handle new picture");
|
||||
goto unmap_and_error;
|
||||
}
|
||||
}
|
||||
|
||||
if (klass->start_picture) {
|
||||
if (!klass->start_picture (self, picture)) {
|
||||
GST_ERROR_OBJECT (self, "start picture error");
|
||||
ret = klass->start_picture (self, picture);
|
||||
if (ret != GST_FLOW_OK) {
|
||||
GST_WARNING_OBJECT (self, "subclass failed to handle start picture");
|
||||
goto unmap_and_error;
|
||||
}
|
||||
}
|
||||
|
||||
if (klass->decode_picture) {
|
||||
if (!klass->decode_picture (self, picture, priv->dpb)) {
|
||||
GST_ERROR_OBJECT (self, "decode picture error");
|
||||
ret = klass->decode_picture (self, picture, priv->dpb);
|
||||
if (ret != GST_FLOW_OK) {
|
||||
GST_WARNING_OBJECT (self, "subclass failed to decode current picture");
|
||||
goto unmap_and_error;
|
||||
}
|
||||
}
|
||||
|
||||
if (klass->end_picture) {
|
||||
if (!klass->end_picture (self, picture)) {
|
||||
GST_ERROR_OBJECT (self, "end picture error");
|
||||
ret = klass->end_picture (self, picture);
|
||||
if (ret != GST_FLOW_OK) {
|
||||
GST_WARNING_OBJECT (self, "subclass failed to handle end picture");
|
||||
goto unmap_and_error;
|
||||
}
|
||||
}
|
||||
|
@ -394,6 +401,12 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder,
|
|||
ret = klass->output_picture (self, frame, picture);
|
||||
}
|
||||
|
||||
if (ret == GST_FLOW_ERROR) {
|
||||
GST_VIDEO_DECODER_ERROR (self, 1, STREAM, DECODE,
|
||||
("Failed to decode data"), (NULL), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
unmap_and_error:
|
||||
|
@ -407,6 +420,9 @@ error:
|
|||
if (picture)
|
||||
gst_vp9_picture_unref (picture);
|
||||
|
||||
if (ret == GST_FLOW_OK)
|
||||
ret = GST_FLOW_ERROR;
|
||||
|
||||
gst_video_decoder_drop_frame (decoder, frame);
|
||||
GST_VIDEO_DECODER_ERROR (self, 1, STREAM, DECODE,
|
||||
("Failed to decode data"), (NULL), ret);
|
||||
|
|
|
@ -72,7 +72,7 @@ struct _GstVp9DecoderClass
|
|||
*
|
||||
* Since: 1.18
|
||||
*/
|
||||
gboolean (*new_sequence) (GstVp9Decoder * decoder,
|
||||
GstFlowReturn (*new_sequence) (GstVp9Decoder * decoder,
|
||||
const GstVp9FrameHeader *frame_hdr);
|
||||
|
||||
/**
|
||||
|
@ -87,7 +87,7 @@ struct _GstVp9DecoderClass
|
|||
*
|
||||
* Since: 1.18
|
||||
*/
|
||||
gboolean (*new_picture) (GstVp9Decoder * decoder,
|
||||
GstFlowReturn (*new_picture) (GstVp9Decoder * decoder,
|
||||
GstVideoCodecFrame * frame,
|
||||
GstVp9Picture * picture);
|
||||
|
||||
|
@ -126,7 +126,7 @@ struct _GstVp9DecoderClass
|
|||
*
|
||||
* Since: 1.18
|
||||
*/
|
||||
gboolean (*start_picture) (GstVp9Decoder * decoder,
|
||||
GstFlowReturn (*start_picture) (GstVp9Decoder * decoder,
|
||||
GstVp9Picture * picture);
|
||||
|
||||
/**
|
||||
|
@ -140,7 +140,7 @@ struct _GstVp9DecoderClass
|
|||
*
|
||||
* Since: 1.18
|
||||
*/
|
||||
gboolean (*decode_picture) (GstVp9Decoder * decoder,
|
||||
GstFlowReturn (*decode_picture) (GstVp9Decoder * decoder,
|
||||
GstVp9Picture * picture,
|
||||
GstVp9Dpb * dpb);
|
||||
|
||||
|
@ -154,7 +154,7 @@ struct _GstVp9DecoderClass
|
|||
*
|
||||
* Since: 1.18
|
||||
*/
|
||||
gboolean (*end_picture) (GstVp9Decoder * decoder,
|
||||
GstFlowReturn (*end_picture) (GstVp9Decoder * decoder,
|
||||
GstVp9Picture * picture);
|
||||
|
||||
/**
|
||||
|
|
|
@ -141,17 +141,17 @@ static gboolean gst_d3d11_vp9_dec_sink_event (GstVideoDecoder * decoder,
|
|||
GstEvent * event);
|
||||
|
||||
/* GstVp9Decoder */
|
||||
static gboolean gst_d3d11_vp9_dec_new_sequence (GstVp9Decoder * decoder,
|
||||
static GstFlowReturn gst_d3d11_vp9_dec_new_sequence (GstVp9Decoder * decoder,
|
||||
const GstVp9FrameHeader * frame_hdr);
|
||||
static gboolean gst_d3d11_vp9_dec_new_picture (GstVp9Decoder * decoder,
|
||||
static GstFlowReturn gst_d3d11_vp9_dec_new_picture (GstVp9Decoder * decoder,
|
||||
GstVideoCodecFrame * frame, GstVp9Picture * picture);
|
||||
static GstVp9Picture *gst_d3d11_vp9_dec_duplicate_picture (GstVp9Decoder *
|
||||
decoder, GstVideoCodecFrame * frame, GstVp9Picture * picture);
|
||||
static gboolean gst_d3d11_vp9_dec_start_picture (GstVp9Decoder * decoder,
|
||||
static GstFlowReturn gst_d3d11_vp9_dec_start_picture (GstVp9Decoder * decoder,
|
||||
GstVp9Picture * picture);
|
||||
static gboolean gst_d3d11_vp9_dec_decode_picture (GstVp9Decoder * decoder,
|
||||
static GstFlowReturn gst_d3d11_vp9_dec_decode_picture (GstVp9Decoder * decoder,
|
||||
GstVp9Picture * picture, GstVp9Dpb * dpb);
|
||||
static gboolean gst_d3d11_vp9_dec_end_picture (GstVp9Decoder * decoder,
|
||||
static GstFlowReturn gst_d3d11_vp9_dec_end_picture (GstVp9Decoder * decoder,
|
||||
GstVp9Picture * picture);
|
||||
static GstFlowReturn gst_d3d11_vp9_dec_output_picture (GstVp9Decoder *
|
||||
decoder, GstVideoCodecFrame * frame, GstVp9Picture * picture);
|
||||
|
@ -347,7 +347,7 @@ gst_d3d11_vp9_dec_sink_event (GstVideoDecoder * decoder, GstEvent * event)
|
|||
return GST_VIDEO_DECODER_CLASS (parent_class)->sink_event (decoder, event);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_d3d11_vp9_dec_new_sequence (GstVp9Decoder * decoder,
|
||||
const GstVp9FrameHeader * frame_hdr)
|
||||
{
|
||||
|
@ -365,7 +365,7 @@ gst_d3d11_vp9_dec_new_sequence (GstVp9Decoder * decoder,
|
|||
|
||||
if (out_format == GST_VIDEO_FORMAT_UNKNOWN) {
|
||||
GST_ERROR_OBJECT (self, "Could not support profile %d", frame_hdr->profile);
|
||||
return FALSE;
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
}
|
||||
|
||||
gst_video_info_set_format (&info,
|
||||
|
@ -375,22 +375,22 @@ gst_d3d11_vp9_dec_new_sequence (GstVp9Decoder * decoder,
|
|||
decoder->input_state, &info, (gint) frame_hdr->width,
|
||||
(gint) frame_hdr->height, NUM_OUTPUT_VIEW)) {
|
||||
GST_ERROR_OBJECT (self, "Failed to create decoder");
|
||||
return FALSE;
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
}
|
||||
|
||||
if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (self))) {
|
||||
GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
|
||||
return FALSE;
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
}
|
||||
|
||||
/* Will be updated per decode_picture */
|
||||
inner->last_frame_width = inner->last_frame_height = 0;
|
||||
inner->last_show_frame = FALSE;
|
||||
|
||||
return TRUE;
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_d3d11_vp9_dec_new_picture (GstVp9Decoder * decoder,
|
||||
GstVideoCodecFrame * frame, GstVp9Picture * picture)
|
||||
{
|
||||
|
@ -402,7 +402,7 @@ gst_d3d11_vp9_dec_new_picture (GstVp9Decoder * decoder,
|
|||
GST_VIDEO_DECODER (decoder));
|
||||
if (!view_buffer) {
|
||||
GST_DEBUG_OBJECT (self, "No available output view buffer");
|
||||
return FALSE;
|
||||
return GST_FLOW_FLUSHING;
|
||||
}
|
||||
|
||||
GST_LOG_OBJECT (self, "New output view buffer %" GST_PTR_FORMAT, view_buffer);
|
||||
|
@ -412,7 +412,7 @@ gst_d3d11_vp9_dec_new_picture (GstVp9Decoder * decoder,
|
|||
|
||||
GST_LOG_OBJECT (self, "New VP9 picture %p", picture);
|
||||
|
||||
return TRUE;
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static GstVp9Picture *
|
||||
|
@ -446,7 +446,7 @@ gst_d3d11_vp9_dec_duplicate_picture (GstVp9Decoder * decoder,
|
|||
return new_picture;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_d3d11_vp9_dec_start_picture (GstVp9Decoder * decoder,
|
||||
GstVp9Picture * picture)
|
||||
{
|
||||
|
@ -455,7 +455,7 @@ gst_d3d11_vp9_dec_start_picture (GstVp9Decoder * decoder,
|
|||
|
||||
inner->bitstream_buffer.resize (0);
|
||||
|
||||
return TRUE;
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static ID3D11VideoDecoderOutputView *
|
||||
|
@ -658,7 +658,7 @@ gst_d3d11_vp9_dec_copy_segmentation_params (GstD3D11Vp9Dec * self,
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_d3d11_vp9_dec_decode_picture (GstVp9Decoder * decoder,
|
||||
GstVp9Picture * picture, GstVp9Dpb * dpb)
|
||||
{
|
||||
|
@ -673,7 +673,7 @@ gst_d3d11_vp9_dec_decode_picture (GstVp9Decoder * decoder,
|
|||
&view_id);
|
||||
if (!view) {
|
||||
GST_ERROR_OBJECT (self, "current picture does not have output view handle");
|
||||
return FALSE;
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
memset (pic_params, 0, sizeof (DXVA_PicParams_VP9));
|
||||
|
@ -702,10 +702,10 @@ gst_d3d11_vp9_dec_decode_picture (GstVp9Decoder * decoder,
|
|||
inner->last_frame_height = pic_params->height;
|
||||
inner->last_show_frame = TRUE;
|
||||
|
||||
return TRUE;
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_d3d11_vp9_dec_end_picture (GstVp9Decoder * decoder, GstVp9Picture * picture)
|
||||
{
|
||||
GstD3D11Vp9Dec *self = GST_D3D11_VP9_DEC (decoder);
|
||||
|
@ -718,14 +718,14 @@ gst_d3d11_vp9_dec_end_picture (GstVp9Decoder * decoder, GstVp9Picture * picture)
|
|||
|
||||
if (inner->bitstream_buffer.empty ()) {
|
||||
GST_ERROR_OBJECT (self, "No bitstream buffer to submit");
|
||||
return FALSE;
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
view = gst_d3d11_vp9_dec_get_output_view_from_picture (self,
|
||||
picture, &view_id);
|
||||
if (!view) {
|
||||
GST_ERROR_OBJECT (self, "current picture does not have output view handle");
|
||||
return FALSE;
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
memset (&input_args, 0, sizeof (GstD3D11DecodeInputStreamArgs));
|
||||
|
@ -751,8 +751,10 @@ gst_d3d11_vp9_dec_end_picture (GstVp9Decoder * decoder, GstVp9Picture * picture)
|
|||
input_args.bitstream = &inner->bitstream_buffer[0];
|
||||
input_args.bitstream_size = inner->bitstream_buffer.size ();
|
||||
|
||||
return gst_d3d11_decoder_decode_frame (inner->d3d11_decoder,
|
||||
view, &input_args);
|
||||
if (!gst_d3d11_decoder_decode_frame (inner->d3d11_decoder, view, &input_args))
|
||||
return GST_FLOW_ERROR;
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
|
|
@ -73,13 +73,13 @@ static gboolean gst_nv_vp9_dec_src_query (GstVideoDecoder * decoder,
|
|||
GstQuery * query);
|
||||
|
||||
/* GstVp9Decoder */
|
||||
static gboolean gst_nv_vp9_dec_new_sequence (GstVp9Decoder * decoder,
|
||||
static GstFlowReturn gst_nv_vp9_dec_new_sequence (GstVp9Decoder * decoder,
|
||||
const GstVp9FrameHeader * frame_hdr);
|
||||
static gboolean gst_nv_vp9_dec_new_picture (GstVp9Decoder * decoder,
|
||||
static GstFlowReturn gst_nv_vp9_dec_new_picture (GstVp9Decoder * decoder,
|
||||
GstVideoCodecFrame * frame, GstVp9Picture * picture);
|
||||
static GstVp9Picture *gst_nv_vp9_dec_duplicate_picture (GstVp9Decoder *
|
||||
decoder, GstVideoCodecFrame * frame, GstVp9Picture * picture);
|
||||
static gboolean gst_nv_vp9_dec_decode_picture (GstVp9Decoder * decoder,
|
||||
static GstFlowReturn gst_nv_vp9_dec_decode_picture (GstVp9Decoder * decoder,
|
||||
GstVp9Picture * picture, GstVp9Dpb * dpb);
|
||||
static GstFlowReturn gst_nv_vp9_dec_output_picture (GstVp9Decoder *
|
||||
decoder, GstVideoCodecFrame * frame, GstVp9Picture * picture);
|
||||
|
@ -230,7 +230,7 @@ gst_nv_vp9_dec_src_query (GstVideoDecoder * decoder, GstQuery * query)
|
|||
return GST_VIDEO_DECODER_CLASS (parent_class)->src_query (decoder, query);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_nv_vp9_dec_new_sequence (GstVp9Decoder * decoder,
|
||||
const GstVp9FrameHeader * frame_hdr)
|
||||
{
|
||||
|
@ -254,7 +254,7 @@ gst_nv_vp9_dec_new_sequence (GstVp9Decoder * decoder,
|
|||
|
||||
if (out_format == GST_VIDEO_FORMAT_UNKNOWN) {
|
||||
GST_ERROR_OBJECT (self, "Could not support profile %d", self->profile);
|
||||
return FALSE;
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
}
|
||||
|
||||
gst_video_info_set_format (&info, out_format, self->width, self->height);
|
||||
|
@ -262,22 +262,22 @@ gst_nv_vp9_dec_new_sequence (GstVp9Decoder * decoder,
|
|||
cudaVideoCodec_VP9, &info, self->width, self->height,
|
||||
NUM_OUTPUT_VIEW)) {
|
||||
GST_ERROR_OBJECT (self, "Failed to configure decoder");
|
||||
return FALSE;
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
}
|
||||
|
||||
if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (self))) {
|
||||
GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
|
||||
return FALSE;
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
}
|
||||
|
||||
memset (&self->params, 0, sizeof (CUVIDPICPARAMS));
|
||||
|
||||
self->params.CodecSpecific.vp9.colorSpace = frame_hdr->color_space;
|
||||
|
||||
return TRUE;
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_nv_vp9_dec_new_picture (GstVp9Decoder * decoder,
|
||||
GstVideoCodecFrame * frame, GstVp9Picture * picture)
|
||||
{
|
||||
|
@ -287,7 +287,7 @@ gst_nv_vp9_dec_new_picture (GstVp9Decoder * decoder,
|
|||
nv_frame = gst_nv_decoder_new_frame (self->decoder);
|
||||
if (!nv_frame) {
|
||||
GST_ERROR_OBJECT (self, "No available decoder frame");
|
||||
return FALSE;
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
GST_LOG_OBJECT (self,
|
||||
|
@ -296,7 +296,7 @@ gst_nv_vp9_dec_new_picture (GstVp9Decoder * decoder,
|
|||
gst_vp9_picture_set_user_data (picture,
|
||||
nv_frame, (GDestroyNotify) gst_nv_decoder_frame_unref);
|
||||
|
||||
return TRUE;
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static GstNvDecoderFrame *
|
||||
|
@ -338,7 +338,7 @@ gst_nv_vp9_dec_duplicate_picture (GstVp9Decoder * decoder,
|
|||
return new_picture;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_nv_vp9_dec_decode_picture (GstVp9Decoder * decoder,
|
||||
GstVp9Picture * picture, GstVp9Dpb * dpb)
|
||||
{
|
||||
|
@ -387,7 +387,7 @@ gst_nv_vp9_dec_decode_picture (GstVp9Decoder * decoder,
|
|||
frame = gst_nv_vp9_dec_get_decoder_frame_from_picture (self, picture);
|
||||
if (!frame) {
|
||||
GST_ERROR_OBJECT (self, "Decoder frame is unavailable");
|
||||
return FALSE;
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
params->nBitstreamDataLen = picture->size;
|
||||
|
@ -479,7 +479,10 @@ gst_nv_vp9_dec_decode_picture (GstVp9Decoder * decoder,
|
|||
memcpy (vp9_params->segmentFeatureData, sp->feature_data,
|
||||
sizeof (sp->feature_data));
|
||||
|
||||
return gst_nv_decoder_decode_picture (self->decoder, &self->params);
|
||||
if (!gst_nv_decoder_decode_picture (self->decoder, &self->params))
|
||||
return GST_FLOW_ERROR;
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
|
|
@ -143,7 +143,7 @@ _get_profile (GstVaVp9Dec * self, GstVP9Profile profile)
|
|||
return VAProfileNone;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_va_vp9_new_sequence (GstVp9Decoder * decoder,
|
||||
const GstVp9FrameHeader * frame_hdr)
|
||||
{
|
||||
|
@ -155,18 +155,18 @@ gst_va_vp9_new_sequence (GstVp9Decoder * decoder,
|
|||
|
||||
profile = _get_profile (self, frame_hdr->profile);
|
||||
if (profile == VAProfileNone)
|
||||
return FALSE;
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
|
||||
if (!gst_va_decoder_has_profile (base->decoder, profile)) {
|
||||
GST_ERROR_OBJECT (self, "Profile %s is not supported",
|
||||
gst_va_profile_name (profile));
|
||||
return FALSE;
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
}
|
||||
|
||||
rt_format = _get_rtformat (self, frame_hdr->profile, frame_hdr->bit_depth,
|
||||
frame_hdr->subsampling_x, frame_hdr->subsampling_y);
|
||||
if (rt_format == 0)
|
||||
return FALSE;
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
|
||||
if (!gst_va_decoder_config_is_equal (base->decoder, profile,
|
||||
rt_format, frame_hdr->width, frame_hdr->height)) {
|
||||
|
@ -183,14 +183,14 @@ gst_va_vp9_new_sequence (GstVp9Decoder * decoder,
|
|||
self->need_negotiation = TRUE;
|
||||
if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (self))) {
|
||||
GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
|
||||
return FALSE;
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
_check_resolution_change (GstVaVp9Dec * self, GstVp9Picture * picture)
|
||||
{
|
||||
GstVaBaseDec *base = GST_VA_BASE_DEC (self);
|
||||
|
@ -204,7 +204,7 @@ _check_resolution_change (GstVaVp9Dec * self, GstVp9Picture * picture)
|
|||
if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (self))) {
|
||||
GST_ERROR_OBJECT (self, "Resolution changed, but failed to"
|
||||
" negotiate with downstream");
|
||||
return FALSE;
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
|
||||
/* @TODO: if negotiation fails, decoder should resize output
|
||||
* frame. For that we would need an auxiliar allocator, and
|
||||
|
@ -212,10 +212,10 @@ _check_resolution_change (GstVaVp9Dec * self, GstVp9Picture * picture)
|
|||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_va_vp9_dec_new_picture (GstVp9Decoder * decoder,
|
||||
GstVideoCodecFrame * frame, GstVp9Picture * picture)
|
||||
{
|
||||
|
@ -225,8 +225,9 @@ gst_va_vp9_dec_new_picture (GstVp9Decoder * decoder,
|
|||
GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
|
||||
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
|
||||
|
||||
if (!_check_resolution_change (self, picture))
|
||||
return FALSE;
|
||||
ret = _check_resolution_change (self, picture);
|
||||
if (ret != GST_FLOW_OK)
|
||||
return ret;
|
||||
|
||||
ret = gst_video_decoder_allocate_output_frame (vdec, frame);
|
||||
if (ret != GST_FLOW_OK)
|
||||
|
@ -240,13 +241,13 @@ gst_va_vp9_dec_new_picture (GstVp9Decoder * decoder,
|
|||
GST_LOG_OBJECT (self, "New va decode picture %p - %#x", pic,
|
||||
gst_va_decode_picture_get_surface (pic));
|
||||
|
||||
return TRUE;
|
||||
return GST_FLOW_OK;
|
||||
|
||||
error:
|
||||
{
|
||||
GST_WARNING_OBJECT (self, "Failed to allocated output buffer, return %s",
|
||||
gst_flow_get_name (ret));
|
||||
return FALSE;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -472,14 +473,17 @@ _fill_slice (GstVp9Decoder * decoder, GstVp9Picture * picture)
|
|||
sizeof (slice_param), (gpointer) picture->data, picture->size);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_va_vp9_decode_picture (GstVp9Decoder * decoder, GstVp9Picture * picture,
|
||||
GstVp9Dpb * dpb)
|
||||
{
|
||||
return _fill_param (decoder, picture, dpb) && _fill_slice (decoder, picture);
|
||||
if (_fill_param (decoder, picture, dpb) && _fill_slice (decoder, picture))
|
||||
return GST_FLOW_OK;
|
||||
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GstFlowReturn
|
||||
gst_va_vp9_dec_end_picture (GstVp9Decoder * decoder, GstVp9Picture * picture)
|
||||
{
|
||||
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
|
||||
|
@ -489,7 +493,10 @@ gst_va_vp9_dec_end_picture (GstVp9Decoder * decoder, GstVp9Picture * picture)
|
|||
|
||||
va_pic = gst_vp9_picture_get_user_data (picture);
|
||||
|
||||
return gst_va_decoder_decode (base->decoder, va_pic);
|
||||
if (!gst_va_decoder_decode (base->decoder, va_pic))
|
||||
return GST_FLOW_ERROR;
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
@ -516,8 +523,10 @@ gst_va_vp9_dec_duplicate_picture (GstVp9Decoder * decoder,
|
|||
GstVaDecodePicture *va_pic, *va_dup;
|
||||
GstVp9Picture *new_picture;
|
||||
|
||||
if (!_check_resolution_change (GST_VA_VP9_DEC (decoder), picture))
|
||||
if (_check_resolution_change (GST_VA_VP9_DEC (decoder), picture) !=
|
||||
GST_FLOW_OK) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
va_pic = gst_vp9_picture_get_user_data (picture);
|
||||
va_dup = gst_va_decode_picture_dup (va_pic);
|
||||
|
|
Loading…
Reference in a new issue