amcvideodec: getOutputBuffers() returns a NULL array when a surface was configured

So don't error out if it does.

https://bugzilla.gnome.org/show_bug.cgi?id=763401
This commit is contained in:
Sebastian Dröge 2016-03-11 10:00:39 +02:00
parent 4e7797546a
commit 9132b72c32
2 changed files with 14 additions and 3 deletions

View file

@ -362,7 +362,10 @@ gst_amc_codec_get_output_buffer (GstAmcCodec * codec, gint index, GError ** err)
if (!media_codec.get_output_buffer) { if (!media_codec.get_output_buffer) {
g_return_val_if_fail (index < codec->n_output_buffers && index >= 0, NULL); g_return_val_if_fail (index < codec->n_output_buffers && index >= 0, NULL);
return gst_amc_buffer_copy (&codec->output_buffers[index]); if (codec->output_buffers[index].object)
return gst_amc_buffer_copy (&codec->output_buffers[index]);
else
return NULL;
} }
if (!gst_amc_jni_call_object_method (env, err, codec->object, if (!gst_amc_jni_call_object_method (env, err, codec->object,
@ -440,7 +443,10 @@ gst_amc_codec_get_input_buffer (GstAmcCodec * codec, gint index, GError ** err)
if (!media_codec.get_input_buffer) { if (!media_codec.get_input_buffer) {
g_return_val_if_fail (index < codec->n_input_buffers && index >= 0, NULL); g_return_val_if_fail (index < codec->n_input_buffers && index >= 0, NULL);
return gst_amc_buffer_copy (&codec->input_buffers[index]); if (codec->input_buffers[index].object)
return gst_amc_buffer_copy (&codec->input_buffers[index]);
else
return NULL;
} }
if (!gst_amc_jni_call_object_method (env, err, codec->object, if (!gst_amc_jni_call_object_method (env, err, codec->object,

View file

@ -1028,12 +1028,17 @@ gst_amc_jni_get_buffer_array (JNIEnv * env, GError ** err, jobject array,
jobject buffer = NULL; jobject buffer = NULL;
buffer = (*env)->GetObjectArrayElement (env, array, i); buffer = (*env)->GetObjectArrayElement (env, array, i);
if ((*env)->ExceptionCheck (env) || !buffer) { if ((*env)->ExceptionCheck (env)) {
gst_amc_jni_set_error (env, err, GST_LIBRARY_ERROR, gst_amc_jni_set_error (env, err, GST_LIBRARY_ERROR,
GST_LIBRARY_ERROR_FAILED, "Failed to get buffer %d", i); GST_LIBRARY_ERROR_FAILED, "Failed to get buffer %d", i);
goto error; goto error;
} }
/* NULL buffers are not a problem and are happening when we configured
* a surface as input/output */
if (!buffer)
continue;
(*buffers)[i].object = gst_amc_jni_object_make_global (env, buffer); (*buffers)[i].object = gst_amc_jni_object_make_global (env, buffer);
if (!(*buffers)[i].object) { if (!(*buffers)[i].object) {
gst_amc_jni_set_error (env, err, GST_LIBRARY_ERROR, gst_amc_jni_set_error (env, err, GST_LIBRARY_ERROR,