From 181fb555bb72ac5ba5460db6ec8efbf7366a12f3 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 17 Feb 2023 08:41:03 +0100 Subject: [PATCH] Change PTS origin type from uint64_t to int64_t It is initialized from AVPacket.pts, which is an int64_t. --- app/src/recorder.c | 6 ++---- app/src/recorder.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/recorder.c b/app/src/recorder.c index 455e1db1..d75f1b12 100644 --- a/app/src/recorder.c +++ b/app/src/recorder.c @@ -11,8 +11,6 @@ /** Downcast packet_sink to recorder */ #define DOWNCAST(SINK) container_of(SINK, struct sc_recorder, packet_sink) -#define SC_PTS_ORIGIN_NONE UINT64_C(-1) - static const AVRational SCRCPY_TIME_BASE = {1, 1000000}; // timestamps in us static const AVOutputFormat * @@ -171,7 +169,7 @@ run_recorder(void *data) { sc_mutex_unlock(&recorder->mutex); - if (recorder->pts_origin == SC_PTS_ORIGIN_NONE + if (recorder->pts_origin == AV_NOPTS_VALUE && rec->packet->pts != AV_NOPTS_VALUE) { // First PTS received recorder->pts_origin = rec->packet->pts; @@ -257,7 +255,7 @@ sc_recorder_open(struct sc_recorder *recorder, const AVCodec *input_codec) { recorder->failed = false; recorder->header_written = false; recorder->previous = NULL; - recorder->pts_origin = SC_PTS_ORIGIN_NONE; + recorder->pts_origin = AV_NOPTS_VALUE; const char *format_name = sc_recorder_get_format_name(recorder->format); assert(format_name); diff --git a/app/src/recorder.h b/app/src/recorder.h index a03c91d7..e6c66f99 100644 --- a/app/src/recorder.h +++ b/app/src/recorder.h @@ -28,7 +28,7 @@ struct sc_recorder { struct sc_size declared_frame_size; bool header_written; - uint64_t pts_origin; + int64_t pts_origin; sc_thread thread; sc_mutex mutex;