libdvr: Images stoped when playing DTV [1/1]
PD#SWPL-90382
Problem:
libdvr prints are not friendly for issue analysis.
Solution:
Improve log prints to make it easier to understand.
Verify:
Locally tested OK in AH212 RDK environment.
Signed-off-by: Wentao.MA <wentao.ma@amlogic.com>
Change-Id: I72732abaf20dcc2d941f9368a99314c6c26123e4
(cherry picked from commit 2416acb38b5b8866f5ac124d4be5d0280e891e1f)
diff --git a/src/dvr_utils.c b/src/dvr_utils.c
index 7a04bc6..d0ccb3f 100644
--- a/src/dvr_utils.c
+++ b/src/dvr_utils.c
@@ -245,3 +245,33 @@
return DVR_FAILURE;
}
+#define NSEC_PER_SEC 1000000000L
+void clock_timespec_subtract(struct timespec *ts1, struct timespec *ts2, struct timespec *ts3)
+{
+ time_t sec;
+ long nsec;
+ sec = ts1->tv_sec - ts2->tv_sec;
+ nsec = ts1->tv_nsec - ts2->tv_nsec;
+ if (ts1->tv_sec >= 0 && ts1->tv_nsec >=0) {
+ if ((sec < 0 && nsec > 0) || (sec > 0 && nsec >= NSEC_PER_SEC)) {
+ nsec -= NSEC_PER_SEC;
+ sec++;
+ }
+ if (sec > 0 && nsec < 0) {
+ nsec += NSEC_PER_SEC;
+ sec--;
+ }
+ } else {
+ if (nsec <= -NSEC_PER_SEC || nsec >= NSEC_PER_SEC) {
+ nsec += NSEC_PER_SEC;
+ sec--;
+ }
+ if ((sec < 0 && nsec > 0)) {
+ nsec -= NSEC_PER_SEC;
+ sec++;
+ }
+ }
+ ts3->tv_sec = sec;
+ ts3->tv_nsec = nsec;
+}
+