playback: keep a gap to the live in the seek [1/1]
PD#SWPL-166871
Problem:
player's cache underflow
Solution:
keep a gap to the live
Verify:
PB
Change-Id: I57d6e5a149fa7fa0ea777e5fa443143a18f9bc0f
Signed-off-by: Zhiqiang Han <zhiqiang.han@amlogic.com>
diff --git a/src/dvr_wrapper.c b/src/dvr_wrapper.c
index 9c0a5ef..e20c8e5 100644
--- a/src/dvr_wrapper.c
+++ b/src/dvr_wrapper.c
@@ -2314,6 +2314,28 @@
DVR_WRAPPER_WARN("time_offset %u is out of range, so seek to"
" the end position of segment %llu",time_offset,segment_id);
}
+
+ /*
+ 1. timeshift or playback of a running recording
+ 2. live_gap set
+ 3. keep a gap to the live, to avoid underflow of player's cache
+ */
+ int live_gap = dvr_prop_read_int("vendor.tv.libdvr.live_gap", 0);
+
+ if (live_gap) {
+
+ if (ctx->playback.param_open.is_timeshift
+ || ctx_isPlay_recording(ctx->playback.param_open.location)) {
+
+ if (segment_id == last_id && segment_offset == last_duration) {
+ DVR_WRAPPER_INFO("seek to the end, round back %dms to make play smoothly, %u-%d",
+ live_gap, segment_offset, live_gap);
+
+ segment_offset -= live_gap;
+ }
+ }
+ }
+
}
DVR_WRAPPER_INFO("seek playback(sn:%ld) (segment_id:%llu, segment_offset:%u)\n",