Skip to content

urisourcebin: Avoid potential unitialized/wrong bitrate value

Only calculate and set the bitrate if all conditions are met.

cc @ystreet

Step #4: /src/gst-plugins-base/gst/playback/gsturisourcebin.c:1010:11: error: variable 'bitrate' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
Step #4: make[3]: Leaving directory '/work/gst-plugins-base/gst/volume'
Step #4:       if (g_object_class_find_property (G_OBJECT_GET_CLASS (slot->queue),
Step #4:           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Step #4: /src/gst-plugins-base/gst/playback/gsturisourcebin.c:1016:47: note: uninitialized use occurs here
Step #4:           gst_util_uint64_scale (buffer_size, bitrate, cumulative_bitrate);
Step #4:                                               ^~~~~~~
Step #4: /src/gst-plugins-base/gst/playback/gsturisourcebin.c:1010:7: note: remove the 'if' if its condition is always true
Step #4:       if (g_object_class_find_property (G_OBJECT_GET_CLASS (slot->queue),
Step #4:       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Step #4: /src/gst-plugins-base/gst/playback/gsturisourcebin.c:1006:20: note: initialize the variable 'bitrate' to silence this warning
Step #4:     guint64 bitrate;
Step #4:                    ^
Step #4:                     = 0
Step #4:   CC       libgstplayback_la-gstplaysinkaudioconvert.lo
Step #4: ar: `u' modifier ignored since `D' is the default (see `U')
Step #4: 1 error generated.

Merge request reports

Loading