瀏覽代碼

libobs: When interleaving packets, make video come first

During packet interleaving (for outputs), ensure that if two packets
coincide with the same timestamp, that the video packet always comes
first instead of the audio packet.

This fix is required to make FLV demux properly with certain demuxers;
some FLV demuxers expect the video packet before the audio packet when
two packets coincide with the same timestamps.
jp9000 8 年之前
父節點
當前提交
260de35be6
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      libobs/obs-output.c

+ 5 - 1
libobs/obs-output.c

@@ -1337,8 +1337,12 @@ static inline void insert_interleaved_packet(struct obs_output *output,
 		struct encoder_packet *cur_packet;
 		struct encoder_packet *cur_packet;
 		cur_packet = output->interleaved_packets.array + idx;
 		cur_packet = output->interleaved_packets.array + idx;
 
 
-		if (out->dts_usec < cur_packet->dts_usec)
+		if (out->dts_usec == cur_packet->dts_usec &&
+		    out->type == OBS_ENCODER_VIDEO) {
 			break;
 			break;
+		} else if (out->dts_usec < cur_packet->dts_usec) {
+			break;
+		}
 	}
 	}
 
 
 	da_insert(output->interleaved_packets, idx, out);
 	da_insert(output->interleaved_packets, idx, out);