Change PTS origin type from uint64_t to int64_t

It is initialized from AVPacket.pts, which is an int64_t.
This commit is contained in:
Romain Vimont 2023-02-17 08:41:03 +01:00
parent fa99763668
commit 181fb555bb
2 changed files with 3 additions and 5 deletions

View file

@ -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);

View file

@ -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;