Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multistream-player
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Daniel Stone
multistream-player
Commits
48880bde
Commit
48880bde
authored
5 years ago
by
olivier.crete@collabora.com
Browse files
Options
Downloads
Patches
Plain Diff
Recreate the pipeline on errors
parent
db5888a7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.c
+34
-20
34 additions, 20 deletions
src/main.c
with
34 additions
and
20 deletions
src/main.c
+
34
−
20
View file @
48880bde
...
...
@@ -52,6 +52,9 @@ static MssStream streams_data[] = {
VIDEO_SINK
,
2500
,
1242
,
NULL
},
};
static
gboolean
setup_stream
(
MssStream
*
stream
);
static
void
validate_system
(
void
)
{
...
...
@@ -105,9 +108,10 @@ error_cb (GstBus * bus, GstMessage * msg, gpointer user_data)
g_print
(
"Debug details: %s
\n
"
,
debug
);
gst_element_set_state
(
stream
->
pipeline
,
GST_STATE_NULL
);
g_clear_object
(
&
stream
->
pipeline
);
/* Retry in 3s...*/
g_timeout_add_seconds
(
3
,
(
GSourceFunc
)
play
_stream
,
stream
);
g_timeout_add_seconds
(
3
,
(
GSourceFunc
)
setup
_stream
,
stream
);
}
static
GstBusSyncReply
...
...
@@ -149,33 +153,43 @@ drop:
return
GST_BUS_DROP
;
}
static
gboolean
setup_stream
(
MssStream
*
stream
)
{
g_autoptr
(
GError
)
error
=
NULL
;
g_autoptr
(
GstBus
)
bus
=
NULL
;
stream
->
pipeline
=
gst_parse_launch
(
stream
->
description
,
&
error
);
if
(
!
stream
->
pipeline
)
{
GtkWidget
*
dialog
=
gtk_message_dialog_new
(
GTK_WINDOW
(
player
.
window
),
GTK_DIALOG_DESTROY_WITH_PARENT
,
GTK_MESSAGE_ERROR
,
GTK_BUTTONS_CLOSE
,
"Failed to create stream pipeline: %s"
,
error
->
message
);
gtk_dialog_run
(
GTK_DIALOG
(
dialog
));
g_application_quit
(
player
.
app
);
return
G_SOURCE_REMOVE
;
}
bus
=
gst_pipeline_get_bus
(
GST_PIPELINE
(
stream
->
pipeline
));
gst_bus_add_signal_watch
(
bus
);
g_signal_connect
(
bus
,
"message::error"
,
G_CALLBACK
(
error_cb
),
stream
);
gst_bus_set_sync_handler
(
bus
,
bus_sync_handler
,
stream
,
NULL
);
play_stream
(
stream
);
return
G_SOURCE_REMOVE
;
}
static
void
setup_streams
()
{
gint
i
;
for
(
i
=
0
;
i
<
G_N_ELEMENTS
(
streams_data
);
i
++
)
{
g_autoptr
(
GError
)
error
=
NULL
;
MssStream
*
stream
=
&
streams_data
[
i
];
g_autoptr
(
GstBus
)
bus
=
NULL
;
stream
->
pipeline
=
gst_parse_launch
(
stream
->
description
,
&
error
);
if
(
!
stream
->
pipeline
)
{
GtkWidget
*
dialog
=
gtk_message_dialog_new
(
GTK_WINDOW
(
player
.
window
),
GTK_DIALOG_DESTROY_WITH_PARENT
,
GTK_MESSAGE_ERROR
,
GTK_BUTTONS_CLOSE
,
"Failed to create stream pipeline: %s"
,
error
->
message
);
gtk_dialog_run
(
GTK_DIALOG
(
dialog
));
g_application_quit
(
player
.
app
);
return
;
}
bus
=
gst_pipeline_get_bus
(
GST_PIPELINE
(
stream
->
pipeline
));
gst_bus_add_signal_watch
(
bus
);
g_signal_connect
(
bus
,
"message::error"
,
G_CALLBACK
(
error_cb
),
stream
);
gst_bus_set_sync_handler
(
bus
,
bus_sync_handler
,
stream
,
NULL
);
play
_stream
(
stream
);
setup
_stream
(
stream
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment