Revision febd72be libavformat/spdifenc.c

View differences:

libavformat/spdifenc.c
347 347
    if (!ctx->pkt_offset)
348 348
        return 0;
349 349

  
350
    padding = (ctx->pkt_offset - ctx->use_preamble * BURST_HEADER_SIZE - ctx->out_bytes) >> 1;
350
    padding = (ctx->pkt_offset - ctx->use_preamble * BURST_HEADER_SIZE - ctx->out_bytes) & ~1;
351 351
    if (padding < 0) {
352 352
        av_log(s, AV_LOG_ERROR, "bitrate is too high\n");
353 353
        return AVERROR(EINVAL);
......
373 373
    if (ctx->out_bytes & 1)
374 374
        put_be16(s->pb, ctx->out_buf[ctx->out_bytes - 1]);
375 375

  
376
    for (; padding > 0; padding--)
377
        put_be16(s->pb, 0);
376
    put_nbyte(s->pb, 0, padding);
378 377

  
379 378
    av_log(s, AV_LOG_DEBUG, "type=%x len=%i pkt_offset=%i\n",
380 379
           ctx->data_type, ctx->out_bytes, ctx->pkt_offset);

Also available in: Unified diff