mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 16:08:51 +00:00
libs: decoder: h264,h265 avoid uninitialized variable
Configuring GCC to verify possible usage of uninitialized variables, shows that found_index might be used without previous assignation. This patch assigns a initial value to found_index, also avoid a branching when returning the result value. https://bugzilla.gnome.org/show_bug.cgi?id=778782
This commit is contained in:
parent
884e0bece2
commit
d6738f3f93
2 changed files with 8 additions and 8 deletions
|
@ -769,7 +769,7 @@ dpb_find_nearest_prev_poc (GstVaapiDecoderH264 * decoder,
|
||||||
{
|
{
|
||||||
GstVaapiDecoderH264Private *const priv = &decoder->priv;
|
GstVaapiDecoderH264Private *const priv = &decoder->priv;
|
||||||
GstVaapiPictureH264 *found_picture = NULL;
|
GstVaapiPictureH264 *found_picture = NULL;
|
||||||
guint i, j, found_index;
|
guint i, j, found_index = -1;
|
||||||
|
|
||||||
g_return_val_if_fail (picture != NULL, -1);
|
g_return_val_if_fail (picture != NULL, -1);
|
||||||
|
|
||||||
|
@ -793,7 +793,7 @@ dpb_find_nearest_prev_poc (GstVaapiDecoderH264 * decoder,
|
||||||
|
|
||||||
if (found_picture_ptr)
|
if (found_picture_ptr)
|
||||||
*found_picture_ptr = found_picture;
|
*found_picture_ptr = found_picture;
|
||||||
return found_picture ? found_index : -1;
|
return found_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finds the picture with the lowest POC that needs to be output */
|
/* Finds the picture with the lowest POC that needs to be output */
|
||||||
|
@ -803,7 +803,7 @@ dpb_find_lowest_poc (GstVaapiDecoderH264 * decoder,
|
||||||
{
|
{
|
||||||
GstVaapiDecoderH264Private *const priv = &decoder->priv;
|
GstVaapiDecoderH264Private *const priv = &decoder->priv;
|
||||||
GstVaapiPictureH264 *found_picture = NULL;
|
GstVaapiPictureH264 *found_picture = NULL;
|
||||||
guint i, j, found_index;
|
guint i, j, found_index = -1;
|
||||||
|
|
||||||
for (i = 0; i < priv->dpb_count; i++) {
|
for (i = 0; i < priv->dpb_count; i++) {
|
||||||
GstVaapiFrameStore *const fs = priv->dpb[i];
|
GstVaapiFrameStore *const fs = priv->dpb[i];
|
||||||
|
@ -824,7 +824,7 @@ dpb_find_lowest_poc (GstVaapiDecoderH264 * decoder,
|
||||||
|
|
||||||
if (found_picture_ptr)
|
if (found_picture_ptr)
|
||||||
*found_picture_ptr = found_picture;
|
*found_picture_ptr = found_picture;
|
||||||
return found_picture ? found_index : -1;
|
return found_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finds the picture with the lowest VOC that needs to be output */
|
/* Finds the picture with the lowest VOC that needs to be output */
|
||||||
|
@ -834,7 +834,7 @@ dpb_find_lowest_voc (GstVaapiDecoderH264 * decoder,
|
||||||
{
|
{
|
||||||
GstVaapiDecoderH264Private *const priv = &decoder->priv;
|
GstVaapiDecoderH264Private *const priv = &decoder->priv;
|
||||||
GstVaapiPictureH264 *found_picture = NULL;
|
GstVaapiPictureH264 *found_picture = NULL;
|
||||||
guint i, j, found_index;
|
guint i, j, found_index = -1;
|
||||||
|
|
||||||
for (i = 0; i < priv->dpb_count; i++) {
|
for (i = 0; i < priv->dpb_count; i++) {
|
||||||
GstVaapiFrameStore *const fs = priv->dpb[i];
|
GstVaapiFrameStore *const fs = priv->dpb[i];
|
||||||
|
@ -851,7 +851,7 @@ dpb_find_lowest_voc (GstVaapiDecoderH264 * decoder,
|
||||||
|
|
||||||
if (found_picture_ptr)
|
if (found_picture_ptr)
|
||||||
*found_picture_ptr = found_picture;
|
*found_picture_ptr = found_picture;
|
||||||
return found_picture ? found_index : -1;
|
return found_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -711,7 +711,7 @@ dpb_find_lowest_poc (GstVaapiDecoderH265 * decoder,
|
||||||
{
|
{
|
||||||
GstVaapiDecoderH265Private *const priv = &decoder->priv;
|
GstVaapiDecoderH265Private *const priv = &decoder->priv;
|
||||||
GstVaapiPictureH265 *found_picture = NULL;
|
GstVaapiPictureH265 *found_picture = NULL;
|
||||||
guint i, found_index;
|
guint i, found_index = -1;
|
||||||
|
|
||||||
for (i = 0; i < priv->dpb_count; i++) {
|
for (i = 0; i < priv->dpb_count; i++) {
|
||||||
GstVaapiPictureH265 *const picture = priv->dpb[i]->buffer;
|
GstVaapiPictureH265 *const picture = priv->dpb[i]->buffer;
|
||||||
|
@ -723,7 +723,7 @@ dpb_find_lowest_poc (GstVaapiDecoderH265 * decoder,
|
||||||
|
|
||||||
if (found_picture_ptr)
|
if (found_picture_ptr)
|
||||||
*found_picture_ptr = found_picture;
|
*found_picture_ptr = found_picture;
|
||||||
return found_picture ? found_index : -1;
|
return found_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
Loading…
Reference in a new issue