diff mbox

[FFmpeg-devel] avcodec/qsvenc Question for Intel QSV low latency

Message ID CANy4d5CHpLy4zNwpGr8SQqbBQMv2m7wHH1379aAchKocxbO2Nw@mail.gmail.com
State Superseded
Headers show

Commit Message

Natsuki Kai Nov. 12, 2017, 2:40 a.m. UTC
Hello guys,

this is my first posting to ffmpeg-devel, and I believe my mail format is
correct.

I'm using ffmpeg for encoding video in real-time, so low encode delay is
needed.
Once I call "avcodec_send_frame(avctx, frame)", I'd like to get the encoded
data from "avcodec_receive_packet(avctx, avpkt)".

However I cannot do that in ffmpeg and Intel QSV (qsv),
"avcodec_receive_packet()" returns nothing when I input the first frame to
qsv encoder by calling "avcodec_send_frame()".
Of cource, after second frame inputs, qsv encoder returns valid data.
I'd like to get a valid data from first calling.

I've tried some cases and as a result, my requirement is satisfied when
avcodec/qsvenc.c will be fixed like below diff info.
Then I have a question.
Why q->async_fifo is set to be q->async_depth "+ 1"?
Anybody knows?

         return AVERROR(ENOMEM);

Comments

Michael Niedermayer Nov. 12, 2017, 4:13 p.m. UTC | #1
On Sun, Nov 12, 2017 at 11:40:57AM +0900, Natsuki Kai wrote:
> Hello guys,
> 
> this is my first posting to ffmpeg-devel, and I believe my mail format is
> correct.
> 
> I'm using ffmpeg for encoding video in real-time, so low encode delay is
> needed.
> Once I call "avcodec_send_frame(avctx, frame)", I'd like to get the encoded
> data from "avcodec_receive_packet(avctx, avpkt)".
> 
> However I cannot do that in ffmpeg and Intel QSV (qsv),
> "avcodec_receive_packet()" returns nothing when I input the first frame to
> qsv encoder by calling "avcodec_send_frame()".
> Of cource, after second frame inputs, qsv encoder returns valid data.
> I'd like to get a valid data from first calling.
> 
> I've tried some cases and as a result, my requirement is satisfied when
> avcodec/qsvenc.c will be fixed like below diff info.
> Then I have a question.
> Why q->async_fifo is set to be q->async_depth "+ 1"?
> Anybody knows?
> 
> --- a/avcodec/qsvenc.c
> +++ b/avcodec/qsvenc.c
> @@ -803,7 +803,7 @@
> 
>      q->param.AsyncDepth = q->async_depth;
> 
> -    q->async_fifo = av_fifo_alloc((1 + q->async_depth) *
> +    q->async_fifo = av_fifo_alloc((q->async_depth) *
>                                    (sizeof(AVPacket) +
> sizeof(mfxSyncPoint*) + sizeof(mfxBitstream*)));
>      if (!q->async_fifo)
>          return AVERROR(ENOMEM);

This looks corrupted by a newline

Applying: avcodec/qsvenc Question for Intel QSV low latency
error: corrupt patch at line 10

[...]
diff mbox

Patch

--- a/avcodec/qsvenc.c
+++ b/avcodec/qsvenc.c
@@ -803,7 +803,7 @@ 

     q->param.AsyncDepth = q->async_depth;

-    q->async_fifo = av_fifo_alloc((1 + q->async_depth) *
+    q->async_fifo = av_fifo_alloc((q->async_depth) *
                                   (sizeof(AVPacket) +
sizeof(mfxSyncPoint*) + sizeof(mfxBitstream*)));
     if (!q->async_fifo)