Quoting Vittorio Giovara (2014-11-23 23:59:24)
> +
> +static int dss_sp_decode_frame(AVCodecContext *avctx, void *data,
> +                               int *got_frame_ptr, AVPacket *avpkt)
> +{
> +    DssSpContext *p    = avctx->priv_data;
> +    AVFrame *frame     = data;
> +    const uint8_t *buf = avpkt->data;
> +    int buf_size       = avpkt->size;
> +
> +    int16_t *out;
> +    int ret;
> +
> +    if (buf_size < DSS_SP_FRAME_SIZE) {
> +        if (buf_size)
> +            av_log(avctx, AV_LOG_WARNING,
> +                   "Expected %d bytes, got %d - skipping packet\n",
> +                   DSS_SP_FRAME_SIZE, buf_size);
> +        *got_frame_ptr = 0;
> +        return buf_size;

Shouldn't this return an error instead? Also, buf_size should never be 0
properly, since this decoder is not marked as having any delay.

> +    }
> +
> +    frame->nb_samples = DSS_SP_SAMPLE_COUNT;
> +    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
> +        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
> +        return ret;
> +    }
> +
> +    out = (int16_t *)frame->data[0];
> +
> +    dss_sp_decode_one_frame(p, out, buf);
> +
> +    *got_frame_ptr = 1;
> +
> +    return DSS_SP_FRAME_SIZE;
> +}
> +
> +AVCodec ff_dss_sp_decoder = {
> +    .name           = "dss_sp",
> +    .long_name      = NULL_IF_CONFIG_SMALL("DSS SP"),
> +    .type           = AVMEDIA_TYPE_AUDIO,
> +    .id             = AV_CODEC_ID_DSS_SP,
> +    .priv_data_size = sizeof(DssSpContext),
> +    .init           = dss_sp_decode_init,
> +    .decode         = dss_sp_decode_frame,

missing CODEC_CAP_DR1 (we really should invert the meaning of it and
mark just the one or two codecs that do _not_ support it)

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to