mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
avoid division by zero and add warning
Original commit message from CVS: avoid division by zero and add warning
This commit is contained in:
parent
3baaec0832
commit
7d83fadc7d
1 changed files with 5 additions and 1 deletions
|
@ -25,7 +25,8 @@ gst_audio_frame_byte_size (GstPad* pad)
|
||||||
/* calculate byte size of an audio frame
|
/* calculate byte size of an audio frame
|
||||||
* this should be moved closer to the gstreamer core
|
* this should be moved closer to the gstreamer core
|
||||||
* and be implemented for every mime type IMO
|
* and be implemented for every mime type IMO
|
||||||
* returns 0 if there's an error, or the byte size if everything's ok
|
* returns -1 if there's an error (to avoid division by zero),
|
||||||
|
* or the byte size if everything's ok
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int width = 0;
|
int width = 0;
|
||||||
|
@ -37,8 +38,11 @@ gst_audio_frame_byte_size (GstPad* pad)
|
||||||
caps = GST_PAD_CAPS (pad);
|
caps = GST_PAD_CAPS (pad);
|
||||||
|
|
||||||
if (caps == NULL)
|
if (caps == NULL)
|
||||||
|
{
|
||||||
/* ERROR: could not get caps of pad */
|
/* ERROR: could not get caps of pad */
|
||||||
|
g_error ("gstaudio: warning: could not get caps of pad %p\n", pad);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
gst_caps_get_int (caps, "width", &width);
|
gst_caps_get_int (caps, "width", &width);
|
||||||
gst_caps_get_int (caps, "channels", &channels);
|
gst_caps_get_int (caps, "channels", &channels);
|
||||||
|
|
Loading…
Reference in a new issue