In the worst case the startcode prefix has 4 bytes. This fixes a trigerred assertion: Assertion dp <= max_size failed at libavcodec/cbs_h2645.c:1451
Unified · Split
| @@ -1395,7 +1395,7 @@ static int cbs_h2645_assemble_fragment(CodedBitstreamContext *ctx, · 1394 unmodified lines | ||
| 1395 | 1395 | max_size = 0; |
| 1396 | 1396 | for (i = 0; i < frag->nb_units; i++) { |
| 1397 | 1397 | // Start code + content with worst-case emulation prevention. |
| 1398 | − max_size += 3 + frag->units[i].data_size * 3 / 2; | |
| 1398 | + max_size += 4 + frag->units[i].data_size * 3 / 2; | |
| 1399 | 1399 | } |
| 1400 | 1400 | |
| 1401 | 1401 | data = av_realloc(NULL, max_size + AV_INPUT_BUFFER_PADDING_SIZE); |