mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 03:00:35 +00:00
9799875df4
Currently the src caps are set immediately after the sink caps are set, but in that moment the pipeline might not fully constructed and the video sink has not negotiated its supported caps and features. As a consequence, in many cases of playback, the least optimized caps feature is forced. This is partially the responsible of bug #744039. Also, vaapidecode doesn't attend the reconfigure events from downstream, which is a problem too, since the video sink can be changed with different caps features. This patch delays the src caps, setting them until the first frame arrives to the decoder, assuming until that very moment the whole pipeline is already negotiated. Particularly, it checks if the src pad needs to be reconfigured, as a consequence of a reconfiguration event from downstream. A key part of this patch is the new GstVaapiCapsFeature GST_VAAPI_CAPS_FEATURE_NOT_NEGOTIATED, which is returned when the src pad doesn't have a peer yet. Also, for a better report of the caps allowed through the src pad and its peer, this patch uses gst_pad_get_allowed_caps() instead of gst_pad_peer_query_caps() when looking for the preferred feature. v3: move the input_state unref to close(), since videodecoder resets at some events such as navigation. v4: a) the state_changed() callback replaces the input_state if the media changed, so this case is also handled. b) since the parameter ref_state in gst_vaapidecode_update_src_caps() is always the input_state, the parameter were removed. c) there were a lot of repeated code handling the input_state, so I refactored it with the function gst_vaapi_decode_input_state_replace(). https://bugzilla.gnome.org/show_bug.cgi?id=744618 Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com> Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
91 lines
3 KiB
C
91 lines
3 KiB
C
/*
|
|
* gstvaapidecode.h - VA-API video decoder
|
|
*
|
|
* Copyright (C) 2010-2011 Splitted-Desktop Systems
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
|
|
* Copyright (C) 2011-2013 Intel Corporation
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public License
|
|
* as published by the Free Software Foundation; either version 2.1
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free
|
|
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
* Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#ifndef GST_VAAPIDECODE_H
|
|
#define GST_VAAPIDECODE_H
|
|
|
|
#include "gstvaapipluginbase.h"
|
|
#include <gst/vaapi/gstvaapidecoder.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
#define GST_TYPE_VAAPIDECODE \
|
|
(gst_vaapidecode_get_type())
|
|
|
|
#define GST_VAAPIDECODE(obj) \
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
|
|
GST_TYPE_VAAPIDECODE, \
|
|
GstVaapiDecode))
|
|
|
|
#define GST_VAAPIDECODE_CLASS(klass) \
|
|
(G_TYPE_CHECK_CLASS_CAST((klass), \
|
|
GST_TYPE_VAAPIDECODE, \
|
|
GstVaapiDecodeClass))
|
|
|
|
#define GST_IS_VAAPIDECODE(obj) \
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VAAPIDECODE))
|
|
|
|
#define GST_IS_VAAPIDECODE_CLASS(klass) \
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VAAPIDECODE))
|
|
|
|
#define GST_VAAPIDECODE_GET_CLASS(obj) \
|
|
(G_TYPE_INSTANCE_GET_CLASS((obj), \
|
|
GST_TYPE_VAAPIDECODE, \
|
|
GstVaapiDecodeClass))
|
|
|
|
typedef struct _GstVaapiDecode GstVaapiDecode;
|
|
typedef struct _GstVaapiDecodeClass GstVaapiDecodeClass;
|
|
|
|
struct _GstVaapiDecode {
|
|
/*< private >*/
|
|
GstVaapiPluginBase parent_instance;
|
|
|
|
GstCaps *sinkpad_caps;
|
|
GstCaps *srcpad_caps;
|
|
GstVaapiDecoder *decoder;
|
|
GMutex decoder_mutex;
|
|
GCond decoder_ready;
|
|
GstFlowReturn decoder_loop_status;
|
|
volatile gboolean decoder_finish;
|
|
GCond decoder_finish_done;
|
|
GstCaps *decoder_caps;
|
|
GstCaps *allowed_caps;
|
|
guint current_frame_size;
|
|
guint has_texture_upload_meta : 1;
|
|
|
|
GstVideoCodecState *input_state;
|
|
volatile gboolean active;
|
|
};
|
|
|
|
struct _GstVaapiDecodeClass {
|
|
/*< private >*/
|
|
GstVaapiPluginBaseClass parent_class;
|
|
};
|
|
|
|
GType
|
|
gst_vaapidecode_get_type(void) G_GNUC_CONST;
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* GST_VAAPIDECODE_H */
|