mirror of
https://github.com/albfan/miraclecast.git
synced 2025-02-15 02:21:54 +00:00
Merge "gstencoder: exit if pipeline encounter error, EOS or enter NULL state"
This commit is contained in:
commit
eca959c711
1 changed files with 12 additions and 7 deletions
|
@ -293,6 +293,8 @@ internal class GstEncoder : DispdEncoder, GLib.Object
|
|||
}
|
||||
|
||||
pipeline.set_state(Gst.State.NULL);
|
||||
state = DispdEncoderState.NULL;
|
||||
defered_terminate();
|
||||
}
|
||||
|
||||
public async void prepare() throws Error
|
||||
|
@ -312,6 +314,14 @@ internal class GstEncoder : DispdEncoder, GLib.Object
|
|||
Posix.fsync(3);
|
||||
}
|
||||
|
||||
private void defered_terminate()
|
||||
{
|
||||
Timeout.add(100, () => {
|
||||
loop.quit();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
private void check_configs() throws DispdEncoderError
|
||||
{
|
||||
if(null == configs || null == pipeline) {
|
||||
|
@ -331,10 +341,12 @@ internal class GstEncoder : DispdEncoder, GLib.Object
|
|||
switch(m.type) {
|
||||
case Gst.MessageType.EOS:
|
||||
error("unexpected EOS");
|
||||
defered_terminate();
|
||||
break;
|
||||
case Gst.MessageType.ERROR:
|
||||
m.parse_error(out e, out d);
|
||||
error("unexpected error: %s\n%s".printf(e.message, d));
|
||||
defered_terminate();
|
||||
break;
|
||||
case Gst.MessageType.STATE_CHANGED:
|
||||
Gst.State oldstate;
|
||||
|
@ -354,13 +366,6 @@ internal class GstEncoder : DispdEncoder, GLib.Object
|
|||
state = DispdEncoderState.PAUSED;
|
||||
}
|
||||
break;
|
||||
case Gst.State.NULL:
|
||||
state = DispdEncoderState.NULL;
|
||||
Timeout.add(100, () => {
|
||||
loop.quit();
|
||||
return false;
|
||||
});
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue