dmx: Do timeshift than FF,the progress bar time display error. [2/3]
PD#SWPL-23655
Problem:
get delay time error.
Solution:
1. del check cache time.
2. add record state when send event.
3. add fffb play flag. if first set fffb speed,we will fffb at thread.
4. init fffb time and add last_cur_time. used last cur time to check
time is error.
5. change debug api.
6. deal pcr is discontinue when stream is loop.
7. set segment id when send rec event.
8. update store info when start next segment.
9. add del segment throw location api.
10. add segment luck when change segment.
11. del send notify time event.
Verify:
verified on 214.
Signed-off-by: hualing chen <hualing.chen@amlogic.com>
Change-Id: Ia3eaa0a629077f4ac01b8ec440a971dd840965e9
diff --git a/src/segment.c b/src/segment.c
index 9515a9e..47fd0ea 100644
--- a/src/segment.c
+++ b/src/segment.c
@@ -141,7 +141,7 @@
p_ctx->segment_id = params->segment_id;
strncpy(p_ctx->location, params->location, strlen(params->location));
- //DVR_DEBUG(1, "%s, open file success p_ctx->location [%s]", __func__, p_ctx->location);
+ DVR_DEBUG(1, "%s, open file success p_ctx->location [%s]", __func__, p_ctx->location, params->mode);
*p_handle = (Segment_Handle_t)p_ctx;
return DVR_SUCCESS;
}
@@ -222,18 +222,19 @@
p_ctx->cur_time = pts - p_ctx->first_pts;
} else {
/*Last pts has valid value*/
- if (pts - p_ctx->last_pts > MAX_PTS_THRESHOLD) {
+ int diff = pts - p_ctx->last_pts;
+ if ((diff > MAX_PTS_THRESHOLD) || (diff < 0)) {
/*Current pts has a transition*/
DVR_DEBUG(1, "Current pts has a transition, [%llu, %llu, %llu]",
p_ctx->first_pts, p_ctx->last_pts, pts);
} else {
/*This is a normal pts, record it*/
- p_ctx->cur_time += (pts - p_ctx->last_pts);
+ p_ctx->cur_time += diff;
sprintf(buf, "\n{time=%llu, offset=%lld}", p_ctx->cur_time, offset);
}
}
-
- fputs(buf, p_ctx->index_fp);
+ if (strlen(buf) > 0)
+ fputs(buf, p_ctx->index_fp);
p_ctx->last_pts = pts;
fflush(p_ctx->index_fp);
fsync(fileno(p_ctx->index_fp));