From 6494d461113ce50846c017ffac36a4ccbd747343 Mon Sep 17 00:00:00 2001 From: jpark37 Date: Wed, 17 Aug 2022 01:11:03 -0700 Subject: [PATCH] libobs: Use nal_ref_idc for H.264 priority H.264 spec only mentions zero/non-zero, but RFC 6184 uses 0/1/2/3 values for prioritization. Go back to reading packet field for priority. --- libobs/obs-avc.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/libobs/obs-avc.c b/libobs/obs-avc.c index 25e5aad32..950c29347 100644 --- a/libobs/obs-avc.c +++ b/libobs/obs-avc.c @@ -55,16 +55,12 @@ static int compute_avc_keyframe_priority(const uint8_t *nal_start, bool *is_keyframe, int priority) { const int type = nal_start[0] & 0x1F; - - switch (type) { - case OBS_NAL_SLICE: - if (priority < OBS_NAL_PRIORITY_HIGH) - priority = OBS_NAL_PRIORITY_HIGH; - break; - case OBS_NAL_SLICE_IDR: + if (type == OBS_NAL_SLICE_IDR) *is_keyframe = true; - priority = OBS_NAL_PRIORITY_HIGHEST; - } + + const int new_priority = nal_start[0] >> 5; + if (priority < new_priority) + priority = new_priority; return priority; }