Commit 3801bc7d authored by Shuah Khan's avatar Shuah Khan Committed by Mauro Carvalho Chehab

[media] media: Media Controller fix to not let stream_count go negative

Change media_entity_pipeline_stop() to not decrement
stream_count of an inactive media pipeline. Doing so,
results in preventing starting the pipeline.
Signed-off-by: default avatarShuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent d40ec6fd
...@@ -452,9 +452,12 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity, ...@@ -452,9 +452,12 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity,
media_entity_graph_walk_start(graph, entity_err); media_entity_graph_walk_start(graph, entity_err);
while ((entity_err = media_entity_graph_walk_next(graph))) { while ((entity_err = media_entity_graph_walk_next(graph))) {
/* don't let the stream_count go negative */
if (entity->stream_count > 0) {
entity_err->stream_count--; entity_err->stream_count--;
if (entity_err->stream_count == 0) if (entity_err->stream_count == 0)
entity_err->pipe = NULL; entity_err->pipe = NULL;
}
/* /*
* We haven't increased stream_count further than this * We haven't increased stream_count further than this
...@@ -486,10 +489,13 @@ void media_entity_pipeline_stop(struct media_entity *entity) ...@@ -486,10 +489,13 @@ void media_entity_pipeline_stop(struct media_entity *entity)
media_entity_graph_walk_start(graph, entity); media_entity_graph_walk_start(graph, entity);
while ((entity = media_entity_graph_walk_next(graph))) { while ((entity = media_entity_graph_walk_next(graph))) {
/* don't let the stream_count go negative */
if (entity->stream_count > 0) {
entity->stream_count--; entity->stream_count--;
if (entity->stream_count == 0) if (entity->stream_count == 0)
entity->pipe = NULL; entity->pipe = NULL;
} }
}
if (!--pipe->streaming_count) if (!--pipe->streaming_count)
media_entity_graph_walk_cleanup(graph); media_entity_graph_walk_cleanup(graph);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment