mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 19:31:12 +00:00
Make sure the pipeline is in READY state before trying to set any window handle to the video sink. Send the app the Initialized signal after surface re-creation.
This commit is contained in:
parent
ad8f0daffa
commit
8548d90aac
1 changed files with 5 additions and 1 deletions
|
@ -160,6 +160,7 @@ static void *app_function (void *userdata) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* Set the pipeline to READY, so it can already accept a window handle, if we have one */
|
||||
gst_element_set_state(data->pipeline, GST_STATE_READY);
|
||||
|
||||
data->video_sink = gst_bin_get_by_interface(GST_BIN(data->pipeline), GST_TYPE_X_OVERLAY);
|
||||
|
@ -210,6 +211,7 @@ static void gst_native_init (JNIEnv* env, jobject thiz) {
|
|||
SET_CUSTOM_DATA (env, thiz, custom_data_field_id, data);
|
||||
GST_DEBUG_CATEGORY_INIT (debug_category, "tutorial-3", 0, "Android tutorial 3");
|
||||
gst_debug_set_threshold_for_name("tutorial-3", GST_LEVEL_DEBUG);
|
||||
gst_debug_set_threshold_for_name("eglgles*", GST_LEVEL_DEBUG);
|
||||
GST_DEBUG ("Created CustomData at %p", data);
|
||||
data->app = (*env)->NewGlobalRef (env, thiz);
|
||||
GST_DEBUG ("Created GlobalRef for app object at %p", data->app);
|
||||
|
@ -277,6 +279,7 @@ static void gst_native_surface_init (JNIEnv *env, jobject thiz, jobject surface)
|
|||
|
||||
if (data->video_sink) {
|
||||
GST_DEBUG ("Pipeline already created, notifying it about the native window.");
|
||||
gst_element_set_state (data->pipeline, GST_STATE_READY);
|
||||
gst_x_overlay_set_window_handle (GST_X_OVERLAY (data->video_sink), (guintptr)data->native_window);
|
||||
} else {
|
||||
GST_DEBUG ("Pipeline not created yet, it will later be notified about the native window.");
|
||||
|
@ -292,11 +295,12 @@ static void gst_native_surface_finalize (JNIEnv *env, jobject thiz) {
|
|||
|
||||
if (data->video_sink) {
|
||||
gst_x_overlay_set_window_handle (GST_X_OVERLAY (data->video_sink), (guintptr)NULL);
|
||||
gst_element_set_state (data->pipeline, GST_STATE_NULL);
|
||||
gst_element_set_state (data->pipeline, GST_STATE_READY);
|
||||
}
|
||||
|
||||
ANativeWindow_release (data->native_window);
|
||||
data->native_window = NULL;
|
||||
data->initialized = FALSE;
|
||||
}
|
||||
|
||||
/* List of implemented native methods */
|
||||
|
|
Loading…
Reference in a new issue