sbc: Return hard error on allocation or mapping error
authorOlivier CrĂȘte <olivier.crete@collabora.com>
Fri, 11 Dec 2020 21:26:00 +0000 (16:26 -0500)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 8 Apr 2021 00:38:47 +0000 (00:38 +0000)
Also post a message on the bus in these cases.wpe: Emit load-progress messages

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1875>

ext/sbc/gstsbcenc.c

index 8948df8..d4f9b63 100644 (file)
@@ -288,8 +288,6 @@ gst_sbc_enc_handle_frame (GstAudioEncoder * audio_enc, GstBuffer * buffer)
       gst_buffer_replace (&outbuf, NULL);
   }
 
-done:
-
   gst_buffer_unmap (buffer, &in_map);
 
   return gst_audio_encoder_finish_frame (audio_enc, outbuf,
@@ -298,13 +296,16 @@ done:
 /* ERRORS */
 no_buffer:
   {
-    GST_ERROR_OBJECT (enc, "could not allocate output buffer");
-    goto done;
+    gst_buffer_unmap (buffer, &in_map);
+    GST_ELEMENT_ERROR (enc, STREAM, FAILED, (NULL),
+        ("Could not allocate output buffer"));
+    return GST_FLOW_ERROR;
   }
 map_failed:
   {
-    GST_ERROR_OBJECT (enc, "could not map input buffer");
-    goto done;
+    GST_ELEMENT_ERROR (enc, STREAM, FAILED, (NULL),
+        ("Could not allocate output buffer"));
+    return GST_FLOW_ERROR;
   }
 }