BT_LOGV("Making next sink consume: addr=%p", graph);
+ if (!graph->has_sink) {
+ BT_LOGW_STR("Graph has no sink component.");
+ status = BT_GRAPH_STATUS_NO_SINK;
+ goto end;
+ }
+
if (g_queue_is_empty(graph->sinks_to_consume)) {
BT_LOGV_STR("Graph's sink queue is empty: end of graph.");
status = BT_GRAPH_STATUS_END;
goto end;
}
- status = bt_graph_consume(graph);
+ status = bt_graph_consume_no_check(graph);
if (status == BT_GRAPH_STATUS_AGAIN) {
/*
* If AGAIN is received and there are multiple
if (graph->sinks_to_consume->length > 1) {
status = BT_GRAPH_STATUS_OK;
}
+ } else if (status == BT_GRAPH_STATUS_NO_SINK) {
+ goto end;
}
} while (status == BT_GRAPH_STATUS_OK);
}
}
-extern enum bt_graph_status bt_graph_cancel(struct bt_graph *graph)
+enum bt_graph_status bt_graph_cancel(struct bt_graph *graph)
{
enum bt_graph_status ret = BT_GRAPH_STATUS_OK;
return ret;
}
-extern bt_bool bt_graph_is_canceled(struct bt_graph *graph)
+bt_bool bt_graph_is_canceled(struct bt_graph *graph)
{
- return graph ? graph->canceled : BT_FALSE;
+ bt_bool canceled = BT_FALSE;
+
+ if (!graph) {
+ BT_LOGW_STR("Invalid parameter: graph is NULL.");
+ goto end;
+ }
+
+ canceled = graph->canceled;
+
+end:
+ return canceled;
}
BT_HIDDEN
* sink queue to be consumed by bt_graph_consume().
*/
if (bt_component_is_sink(component)) {
+ graph->has_sink = BT_TRUE;
g_queue_push_tail(graph->sinks_to_consume, component);
}