midiparse: small cleanups in error paths
This commit is contained in:
parent
adae7f1859
commit
15f07e7f12
@ -880,7 +880,7 @@ handle_play_midi (GstMidiParse * midiparse,
|
|||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_midi_parse_do_play (GstMidiParse * midiparse)
|
gst_midi_parse_do_play (GstMidiParse * midiparse)
|
||||||
{
|
{
|
||||||
GstFlowReturn res = GST_FLOW_OK;
|
GstFlowReturn res;
|
||||||
GList *walk;
|
GList *walk;
|
||||||
guint64 pulse, next_pulse = G_MAXUINT64;
|
guint64 pulse, next_pulse = G_MAXUINT64;
|
||||||
GstClockTime position, next_position;
|
GstClockTime position, next_position;
|
||||||
@ -899,7 +899,7 @@ gst_midi_parse_do_play (GstMidiParse * midiparse)
|
|||||||
while (!track->eot && track->pulse == pulse) {
|
while (!track->eot && track->pulse == pulse) {
|
||||||
res = handle_next_event (midiparse, track, &cb, NULL);
|
res = handle_next_event (midiparse, track, &cb, NULL);
|
||||||
if (res != GST_FLOW_OK)
|
if (res != GST_FLOW_OK)
|
||||||
goto done;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!track->eot && track->pulse < next_pulse)
|
if (!track->eot && track->pulse < next_pulse)
|
||||||
@ -919,8 +919,6 @@ gst_midi_parse_do_play (GstMidiParse * midiparse)
|
|||||||
|
|
||||||
/* send 10ms ticks to advance the downstream element */
|
/* send 10ms ticks to advance the downstream element */
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
guint8 midi_tick = 0xf9;
|
|
||||||
|
|
||||||
/* get position of next tick */
|
/* get position of next tick */
|
||||||
position = ++tick * (10 * GST_MSECOND);
|
position = ++tick * (10 * GST_MSECOND);
|
||||||
GST_DEBUG_OBJECT (midiparse, "tick %" G_GUINT64_FORMAT
|
GST_DEBUG_OBJECT (midiparse, "tick %" G_GUINT64_FORMAT
|
||||||
@ -930,20 +928,28 @@ gst_midi_parse_do_play (GstMidiParse * midiparse)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
midiparse->segment.position = position;
|
midiparse->segment.position = position;
|
||||||
handle_play_midi (midiparse, midi_tick, NULL, 0, NULL);
|
res = handle_play_midi (midiparse, 0xf9, NULL, 0, NULL);
|
||||||
|
if (res != GST_FLOW_OK)
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
midiparse->pulse = next_pulse;
|
midiparse->pulse = next_pulse;
|
||||||
midiparse->segment.position = next_position;
|
midiparse->segment.position = next_position;
|
||||||
|
|
||||||
done:
|
return GST_FLOW_OK;
|
||||||
return res;
|
|
||||||
|
|
||||||
|
/* ERRORS */
|
||||||
eos:
|
eos:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (midiparse, "we are EOS");
|
GST_DEBUG_OBJECT (midiparse, "we are EOS");
|
||||||
return GST_FLOW_EOS;
|
return GST_FLOW_EOS;
|
||||||
}
|
}
|
||||||
|
error:
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (midiparse, "have flow result %s",
|
||||||
|
gst_flow_get_name (res));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
x
Reference in New Issue
Block a user