videoaggregator: simplify aggregate returning
Rework special handling with goto/labels to only have one case and otherwise just return normally.
This commit is contained in:
parent
443a3beb8f
commit
7b8d819d18
@ -1345,12 +1345,10 @@ gst_videoaggregator_aggregate (GstAggregator * agg, gboolean timeout)
|
|||||||
GST_VIDEO_AGGREGATOR_LOCK (vagg);
|
GST_VIDEO_AGGREGATOR_LOCK (vagg);
|
||||||
|
|
||||||
flow_ret = gst_videoaggregator_check_reconfigure (vagg, timeout);
|
flow_ret = gst_videoaggregator_check_reconfigure (vagg, timeout);
|
||||||
if (flow_ret == GST_FLOW_NEEDS_DATA) {
|
if (flow_ret != GST_FLOW_OK) {
|
||||||
GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
|
if (flow_ret == GST_FLOW_NEEDS_DATA)
|
||||||
return GST_FLOW_OK;
|
flow_ret = GST_FLOW_OK;
|
||||||
} else if (flow_ret != GST_FLOW_OK) {
|
goto unlock_and_return;
|
||||||
GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
|
|
||||||
return flow_ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
output_start_time = gst_videoaggregator_get_next_time (agg);
|
output_start_time = gst_videoaggregator_get_next_time (agg);
|
||||||
@ -1378,14 +1376,13 @@ gst_videoaggregator_aggregate (GstAggregator * agg, gboolean timeout)
|
|||||||
if (flow_ret == GST_FLOW_NEEDS_DATA && !timeout) {
|
if (flow_ret == GST_FLOW_NEEDS_DATA && !timeout) {
|
||||||
GST_DEBUG_OBJECT (vagg, "Need more data for decisions");
|
GST_DEBUG_OBJECT (vagg, "Need more data for decisions");
|
||||||
flow_ret = GST_FLOW_OK;
|
flow_ret = GST_FLOW_OK;
|
||||||
goto done;
|
goto unlock_and_return;
|
||||||
} else if (flow_ret == GST_FLOW_EOS) {
|
} else if (flow_ret == GST_FLOW_EOS) {
|
||||||
GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
|
|
||||||
GST_DEBUG_OBJECT (vagg, "All sinkpads are EOS -- forwarding");
|
GST_DEBUG_OBJECT (vagg, "All sinkpads are EOS -- forwarding");
|
||||||
goto done_unlocked;
|
goto unlock_and_return;
|
||||||
} else if (flow_ret == GST_FLOW_ERROR) {
|
} else if (flow_ret == GST_FLOW_ERROR) {
|
||||||
GST_WARNING_OBJECT (vagg, "Error collecting buffers");
|
GST_WARNING_OBJECT (vagg, "Error collecting buffers");
|
||||||
goto done;
|
goto unlock_and_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
jitter = gst_videoaggregator_do_qos (vagg, output_start_time);
|
jitter = gst_videoaggregator_do_qos (vagg, output_start_time);
|
||||||
@ -1427,14 +1424,13 @@ gst_videoaggregator_aggregate (GstAggregator * agg, gboolean timeout)
|
|||||||
|
|
||||||
flow_ret = gst_aggregator_finish_buffer (agg, outbuf);
|
flow_ret = gst_aggregator_finish_buffer (agg, outbuf);
|
||||||
}
|
}
|
||||||
goto done_unlocked;
|
return flow_ret;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (outbuf)
|
if (outbuf)
|
||||||
gst_buffer_unref (outbuf);
|
gst_buffer_unref (outbuf);
|
||||||
|
unlock_and_return:
|
||||||
GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
|
GST_VIDEO_AGGREGATOR_UNLOCK (vagg);
|
||||||
|
|
||||||
done_unlocked:
|
|
||||||
return flow_ret;
|
return flow_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user