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.
This commit is contained in:
jp9000 2017-09-28 06:17:17 -07:00
parent 8d424cf1c7
commit 260de35be6

View file

@ -1337,8 +1337,12 @@ static inline void insert_interleaved_packet(struct obs_output *output,
struct encoder_packet *cur_packet;
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;
} else if (out->dts_usec < cur_packet->dts_usec) {
break;
}
}
da_insert(output->interleaved_packets, idx, out);