Parcourir la source

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.
jpark37 il y a 3 ans
Parent
commit
6494d46111
1 fichiers modifiés avec 5 ajouts et 9 suppressions
  1. 5 9
      libobs/obs-avc.c

+ 5 - 9
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;
 }