Broken in 6e225123d8583fdce55037b85eaef5453f201959, because ff_copy_bits() expects the amount of bits, not bytes to write. And because it relies on the buffer to be padded, using side_data->size * 8 is not possible. So partially revert said commit. Fixes ticket #11591.
Unified · Split
| @@ -472,7 +472,8 @@ static int mpeg1_encode_picture_header(MPVMainEncContext *const m) · 471 unmodified lines | ||
| 472 | 472 | (side_data->size / 3 & A53_MAX_CC_COUNT) | 0x40); // flags, cc_count |
| 473 | 473 | put_bits(&s->pb, 8, 0xff); // em_data |
| 474 | 474 | |
| 475 | − ff_copy_bits(&s->pb, side_data->data, side_data->size); | |
| 475 | + for (int i = 0; i < side_data->size; i++) | |
| 476 | + put_bits(&s->pb, 8, side_data->data[i]); | |
| 476 | 477 | |
| 477 | 478 | put_bits(&s->pb, 8, 0xff); // marker_bits |
| 478 | 479 | } else { |