// available range, so that any wraparound doesn't happen immediately.
// (Immediate wraparound would be an issue for SRTP.)
if (s->seq < 0) {
- if (st->codec->flags & CODEC_FLAG_BITEXACT) {
+ if (s1->flags & AVFMT_FLAG_BITEXACT) {
s->seq = 0;
} else
s->seq = av_get_random_seed() & 0x0fff;
}
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
/* FIXME: We should round down here... */
- s->max_frames_per_packet = av_rescale_q(s1->max_delay, (AVRational){1, 1000000}, st->codec->time_base);
+ if (st->avg_frame_rate.num > 0 && st->avg_frame_rate.den > 0) {
+ s->max_frames_per_packet = av_rescale_q(s1->max_delay,
+ (AVRational){1, 1000000},
+ av_inv_q(st->avg_frame_rate));
+ } else
+ s->max_frames_per_packet = 1;
}
}