+ avpkt->size = put_bits_count(&pb) >> 3;
+
+ avpkt->duration = ff_samples_to_time_base(avctx, avctx->frame_size);
+ if (frame) {
+ if (frame->pts != AV_NOPTS_VALUE)
+ avpkt->pts = ff_samples_to_time_base(avctx, frame->pts);
+ } else {
+ avpkt->pts = venc->next_pts;
+ }
+ if (avpkt->pts != AV_NOPTS_VALUE)
+ venc->next_pts = avpkt->pts + avpkt->duration;
+
+ *got_packet_ptr = 1;
+ return 0;