libdvr: Images stoped when playing DTV [1/1]
PD#TV-72981
PD#SWPL-113742
Problem:
Live play is easy to stop in an unstable DVB signal environment.
In an unstable DVB signal environment, timeshift is easy to stop then restart
frequently upon signal lost/gain. One of the libdvr linked lists related to
segments is not cleaned properly in timeshift stopping process. Under such
condition, libdvr regards deleted segments as normal ones so that total
counted timeshift size is far bigger than actual size and triggers a recent
introduced total size guard mechanism to discard coming recoming recording
data. As a result, without any new recording data, timeshfit live play stops.
Solution:
Clean the mentioned linked list in timeshift stopping process.
Verify:
FAE tests pass in Amazon HAZEL environment.
Signed-off-by: Wentao.MA <wentao.ma@amlogic.com>
Change-Id: I583d8c6cb11cf7cd4fcd5d0601cb67f4d6e2b688
diff --git a/src/dvr_record.c b/src/dvr_record.c
index 0dc1d41..4a39929 100644
--- a/src/dvr_record.c
+++ b/src/dvr_record.c
@@ -852,6 +852,12 @@
}
DVR_RETURN_IF_FALSE(p_ctx == &record_ctx[i]);
+ if (p_ctx->segment_handle == NULL) {
+ // It seems this stop function has been called twice on the same recording,
+ // so just return success.
+ return DVR_SUCCESS;
+ }
+
DVR_INFO("%s , current state:%d p_ctx->location:%s", __func__, p_ctx->state, p_ctx->location);
DVR_RETURN_IF_FALSE(p_ctx->state != DVR_RECORD_STATE_STOPPED);
DVR_RETURN_IF_FALSE(p_ctx->state != DVR_RECORD_STATE_CLOSED);
diff --git a/src/dvr_wrapper.c b/src/dvr_wrapper.c
index 702996c..3ddcb5d 100644
--- a/src/dvr_wrapper.c
+++ b/src/dvr_wrapper.c
@@ -1292,6 +1292,8 @@
error = dvr_record_stop_segment(ctx->record.recorder, &seg_info);
wrapper_updateRecordSegment(ctx, &seg_info, U_ALL);
+ ctx_freeSegments(ctx);
+
DVR_WRAPPER_INFO("record(sn:%ld) stopped = (%d)\n", ctx->sn, error);
wrapper_mutex_unlock(&ctx->wrapper_lock);