Add error check on prescan of gstreamer audio
This commit is contained in:
1 parent
d208f9d7b9
commit
d910b944ea
1 file changed
+10
-6
@@ -174,9 +174,12 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp
|
|||||||
// Passing CLOCK_TIME_NONE here causes the pipeline to block for a long time so with
|
// Passing CLOCK_TIME_NONE here causes the pipeline to block for a long time so with
|
||||||
// prescan enabled the pipeline will wait 500ms for stream to initialize and then continue
|
// prescan enabled the pipeline will wait 500ms for stream to initialize and then continue
|
||||||
// if it takes more than 500ms, duration queries will be performed asynchronously
|
// if it takes more than 500ms, duration queries will be performed asynchronously
|
||||||
Message msg = _Element.Bus.TimedPopFiltered(prescan ? ulong.MaxValue : 0L, MessageType.AsyncDone);
|
Message msg = _Element.Bus.TimedPopFiltered(prescan ? ulong.MaxValue : 0L, MessageType.AsyncDone | MessageType.Error);
|
||||||
if (msg.Handle != IntPtr.Zero)
|
if (!_OnMessage(msg))
|
||||||
_UpdateDuration();
|
{
|
||||||
|
_Dispose(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
_FileOpened = true;
|
_FileOpened = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -231,10 +234,10 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp
|
|||||||
_Element["volume"] = Volume * VolumeMax;
|
_Element["volume"] = Volume * VolumeMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _OnMessage(Message msg)
|
private bool _OnMessage(Message msg)
|
||||||
{
|
{
|
||||||
if (msg.Handle == IntPtr.Zero)
|
if (msg.Handle == IntPtr.Zero)
|
||||||
return;
|
return true;
|
||||||
switch (msg.Type)
|
switch (msg.Type)
|
||||||
{
|
{
|
||||||
case MessageType.Eos:
|
case MessageType.Eos:
|
||||||
@@ -248,12 +251,13 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp
|
|||||||
string debug;
|
string debug;
|
||||||
msg.ParseError(out error, out debug);
|
msg.ParseError(out error, out debug);
|
||||||
CLog.LogError("Gstreamer error: message" + error.Message + ", code" + error.Code + " ,debug information" + debug);
|
CLog.LogError("Gstreamer error: message" + error.Message + ", code" + error.Code + " ,debug information" + debug);
|
||||||
break;
|
return false;
|
||||||
case MessageType.DurationChanged:
|
case MessageType.DurationChanged:
|
||||||
_UpdateDuration();
|
_UpdateDuration();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
msg.Dispose();
|
msg.Dispose();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
|
|||||||
Reference in new issue
Block a user