shithub: libopusenc

Download patch

ref: 79b6d1a03b20563b3818bc6eec6a029d8322c89c
parent: 83af4e1b1af6f3575e038aff8c704b9f6a1478cd
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Tue May 2 11:11:15 EDT 2017

Fix error codes

--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -259,7 +259,7 @@
   enc->st = st;
   enc->callbacks = *callbacks;
   enc->streams->user_data = user_data;
-  if (error) *error = OPUS_OK;
+  if (error) *error = OPE_OK;
   return enc;
 fail:
   if (enc) {
@@ -270,6 +270,7 @@
   if (st) {
     opus_multistream_encoder_destroy(st);
   }
+  if (error) *error = OPE_INTERNAL_ERROR;
   return NULL;
 }
 
@@ -495,10 +496,11 @@
   assert(enc->streams);
   assert(enc->last_stream);
   new_stream = stream_create();
+  if (!new_stream) return OPE_INTERNAL_ERROR;
   new_stream->user_data = user_data;
   enc->last_stream->next = new_stream;
   enc->last_stream = new_stream;
-  return OPE_UNIMPLEMENTED;
+  return OEP_OK;
 }
 
 /* Add a comment to the file (can only be called before encoding samples). */