This is needed by the AV1-Annex B and AV1-OBU demuxers.
Unified · Split
| @@ -103,10 +103,15 @@ eof: · 102 unmodified lines | ||
| 103 | 103 | err = AVERROR(EAGAIN); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | − // Buffer packets with timestamps. There should be at most one per TU, be it split or not. | |
| 107 | − if (!buffer_pkt->data && in->pts != AV_NOPTS_VALUE) | |
| 106 | + /* Buffer packets with timestamps (there should be at most one per TU) | |
| 107 | + * or any packet if buffer_pkt is empty. The latter is needed to | |
| 108 | + * passthrough positions in case there are no timestamps like with | |
| 109 | + * the raw OBU demuxer. */ | |
| 110 | + if (!buffer_pkt->data || | |
| 111 | + in->pts != AV_NOPTS_VALUE && buffer_pkt->pts == AV_NOPTS_VALUE) { | |
| 112 | + av_packet_unref(buffer_pkt); | |
| 108 | 113 | av_packet_move_ref(buffer_pkt, in); |
| 109 | − else | |
| 114 | + } else | |
| 110 | 115 | av_packet_unref(in); |
| 111 | 116 | |
| 112 | 117 | ff_cbs_fragment_reset(&ctx->frag[ctx->idx]); |