videodecoder: allow using -1 for infinite tolerated errors

Allows using -1 to make videodecoder never post an error message
after decoding errors.

https://bugzilla.gnome.org/show_bug.cgi?id=711094
This commit is contained in:
Thiago Santos 2013-10-29 14:11:51 -03:00
parent 68afb292a2
commit 0765962fbc

View file

@ -3372,7 +3372,8 @@ _gst_video_decoder_error (GstVideoDecoder * dec, gint weight,
GST_WARNING_OBJECT (dec, "error: %s", dbg);
dec->priv->error_count += weight;
dec->priv->discont = TRUE;
if (dec->priv->max_errors < dec->priv->error_count) {
if (dec->priv->max_errors >= 0 &&
dec->priv->error_count > dec->priv->max_errors) {
gst_element_message_full (GST_ELEMENT (dec), GST_MESSAGE_ERROR,
domain, code, txt, dbg, file, function, line);
return GST_FLOW_ERROR;
@ -3389,8 +3390,11 @@ _gst_video_decoder_error (GstVideoDecoder * dec, gint weight,
* @num: max tolerated errors
*
* Sets numbers of tolerated decoder errors, where a tolerated one is then only
* warned about, but more than tolerated will lead to fatal error. Default
* is set to GST_VIDEO_DECODER_MAX_ERRORS.
* warned about, but more than tolerated will lead to fatal error. You can set
* -1 for never returning fatal errors. Default is set to
* GST_VIDEO_DECODER_MAX_ERRORS.
*
* The '-1' option was added in 1.4
*/
void
gst_video_decoder_set_max_errors (GstVideoDecoder * dec, gint num)