From 250f6618fd2dc277567be8f509a1b62ef61dbda6 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 11 Nov 2019 18:42:11 -0800 Subject: [PATCH] Plumb the presentation time from the server into the renderer --- Limelight/Stream/Connection.m | 10 ++++++++-- Limelight/Stream/VideoDecoderRenderer.h | 2 +- Limelight/Stream/VideoDecoderRenderer.m | 2 +- moonlight-common/moonlight-common-c | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Limelight/Stream/Connection.m b/Limelight/Stream/Connection.m index 75d5530..5972823 100644 --- a/Limelight/Stream/Connection.m +++ b/Limelight/Stream/Connection.m @@ -71,7 +71,10 @@ int DrSubmitDecodeUnit(PDECODE_UNIT decodeUnit) while (entry != NULL) { // Submit parameter set NALUs directly since no copy is required by the decoder if (entry->bufferType != BUFFER_TYPE_PICDATA) { - ret = [renderer submitDecodeBuffer:(unsigned char*)entry->data length:entry->length bufferType:entry->bufferType]; + ret = [renderer submitDecodeBuffer:(unsigned char*)entry->data + length:entry->length + bufferType:entry->bufferType + pts:decodeUnit->presentationTimeMs]; if (ret != DR_OK) { free(data); return ret; @@ -86,7 +89,10 @@ int DrSubmitDecodeUnit(PDECODE_UNIT decodeUnit) } // This function will take our picture data buffer - return [renderer submitDecodeBuffer:data length:offset bufferType:BUFFER_TYPE_PICDATA]; + return [renderer submitDecodeBuffer:data + length:offset + bufferType:BUFFER_TYPE_PICDATA + pts:decodeUnit->presentationTimeMs]; } int ArInit(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, void* context, int flags) diff --git a/Limelight/Stream/VideoDecoderRenderer.h b/Limelight/Stream/VideoDecoderRenderer.h index a8e8295..e29f19a 100644 --- a/Limelight/Stream/VideoDecoderRenderer.h +++ b/Limelight/Stream/VideoDecoderRenderer.h @@ -18,6 +18,6 @@ - (void)updateBufferForRange:(CMBlockBufferRef)existingBuffer data:(unsigned char *)data offset:(int)offset length:(int)nalLength; -- (int)submitDecodeBuffer:(unsigned char *)data length:(int)length bufferType:(int)bufferType; +- (int)submitDecodeBuffer:(unsigned char *)data length:(int)length bufferType:(int)bufferType pts:(unsigned int)pts; @end diff --git a/Limelight/Stream/VideoDecoderRenderer.m b/Limelight/Stream/VideoDecoderRenderer.m index 95802c7..8dcddab 100644 --- a/Limelight/Stream/VideoDecoderRenderer.m +++ b/Limelight/Stream/VideoDecoderRenderer.m @@ -201,7 +201,7 @@ } // This function must free data for bufferType == BUFFER_TYPE_PICDATA -- (int)submitDecodeBuffer:(unsigned char *)data length:(int)length bufferType:(int)bufferType +- (int)submitDecodeBuffer:(unsigned char *)data length:(int)length bufferType:(int)bufferType pts:(unsigned int)pts { unsigned char nalType = data[FRAME_START_PREFIX_SIZE]; OSStatus status; diff --git a/moonlight-common/moonlight-common-c b/moonlight-common/moonlight-common-c index 49fd1be..f4dad9a 160000 --- a/moonlight-common/moonlight-common-c +++ b/moonlight-common/moonlight-common-c @@ -1 +1 @@ -Subproject commit 49fd1bed3f40456e98a6ede60558a8ce1964327c +Subproject commit f4dad9ae8bca90aada76c9bb858e4eea0fff5b76