From 4f5fb38ed124a885adba84d1dfaa7f2eaca059af Mon Sep 17 00:00:00 2001 From: Ningyuan Li Date: Thu, 25 Apr 2024 23:57:10 +0900 Subject: [PATCH] updated SS4S requests less IDR frames --- src/app/stream/session.c | 3 ++- src/app/stream/video/session_video.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app/stream/session.c b/src/app/stream/session.c index 0571ba80..b1dd38ef 100644 --- a/src/app/stream/session.c +++ b/src/app/stream/session.c @@ -205,12 +205,13 @@ void streaming_set_hdr(session_t *session, bool hdr) { populate_hdr_info_vui(&info, &session->config.stream); SS4S_PlayerVideoSetHDRInfo(session->player, &info); } else { + // Magic numbers from Stadia SS4S_VideoHDRInfo info = { .displayPrimariesX = {34000, 13250, 7500}, .displayPrimariesY = {16000, 34500, 3000}, .whitePointX = 15635, .whitePointY = 16450, - .maxDisplayMasteringLuminance = 1000 * LUMINANCE_SCALE, + .maxDisplayMasteringLuminance = 1000, .minDisplayMasteringLuminance = 50, .maxContentLightLevel = 1000, .maxPicAverageLightLevel = 400, diff --git a/src/app/stream/video/session_video.c b/src/app/stream/video/session_video.c index 7a66b0fa..e7118bb9 100644 --- a/src/app/stream/video/session_video.c +++ b/src/app/stream/video/session_video.c @@ -104,12 +104,13 @@ int vdec_delegate_setup(int videoFormat, int width, int height, int redrawRate, } switch (SS4S_PlayerVideoOpen(player, &info)) { - case SS4S_VIDEO_OPEN_ERROR: - return CALLBACKS_SESSION_ERROR_VDEC_ERROR; + case SS4S_VIDEO_OPEN_OK: { + return 0; + } case SS4S_VIDEO_OPEN_UNSUPPORTED_CODEC: return CALLBACKS_SESSION_ERROR_VDEC_UNSUPPORTED; default: - return 0; + return CALLBACKS_SESSION_ERROR_VDEC_ERROR; } } @@ -169,8 +170,11 @@ int vdec_delegate_submit(PDECODE_UNIT decodeUnit) { } else if (result == SS4S_VIDEO_FEED_ERROR) { session_interrupt(session, false, STREAMING_INTERRUPT_DECODER); return DR_OK; - } else { + } else if (result == SS4S_VIDEO_FEED_REQUEST_KEYFRAME) { return DR_NEED_IDR; + } else { + commons_log_debug("Session", "Ignoring frame %d, feed result %d", decodeUnit->frameNumber, result); + return DR_OK; } }