playback: use mutex after release [1/1]
PD#TV-112495
Problem:
playback status will be set to STOP in update() procedure,
stop_playback() checked the status and return,
left the playback thread running(leak).
Solution:
stop_playback() should check the thread actcually,
not only the player status.
Verify:
Project
Change-Id: I4f7a2b1a383456f8aadc89a75257b1a245824470
Signed-off-by: Zhiqiang Han <zhiqiang.han@amlogic.com>
diff --git a/src/dvr_playback.c b/src/dvr_playback.c
index c972e9a..341bb81 100644
--- a/src/dvr_playback.c
+++ b/src/dvr_playback.c
@@ -2422,15 +2422,14 @@
DVR_PB_INFO("player is NULL");
return DVR_FAILURE;
}
- if (player->state == DVR_PLAYBACK_STATE_STOP) {
- DVR_PB_INFO(":playback is stoped");
- return DVR_SUCCESS;
- }
- if (player->state == DVR_PLAYBACK_STATE_STOP) {
- DVR_PB_INFO(":playback is stoped");
- return DVR_SUCCESS;
- }
+
_stop_playback_thread(handle);
+
+ if (player->state == DVR_PLAYBACK_STATE_STOP) {
+ DVR_PB_INFO(":playback is stoped");
+ return DVR_SUCCESS;
+ }
+
DVR_PB_DEBUG("lock");
dvr_mutex_lock(&player->lock);
DVR_PB_INFO(":get lock into stop fast");