diff mbox series

[FFmpeg-devel] avcodec/mediacodecdec: Skip dequeue buffer in draining state

Message ID tencent_424C9F1EABA44ECD70F52D559A2240769A08@qq.com
State New
Headers show
Series [FFmpeg-devel] avcodec/mediacodecdec: Skip dequeue buffer in draining state | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili Aug. 23, 2024, 5:19 p.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

There is no more buffer to queue in draining state

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
 libavcodec/mediacodecdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Matthieu Bouron Aug. 24, 2024, 2:11 p.m. UTC | #1
On Fri, Aug 23, 2024 at 7:20 PM Zhao Zhili <quinkblack@foxmail.com> wrote:
>
> From: Zhao Zhili <zhilizhao@tencent.com>
>
> There is no more buffer to queue in draining state

nit: There is no more input buffer to dequeue in draining state.

>
> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
> ---
>  libavcodec/mediacodecdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
> index 6d8dc600fe..0da5fe6729 100644
> --- a/libavcodec/mediacodecdec.c
> +++ b/libavcodec/mediacodecdec.c
> @@ -462,7 +462,7 @@ static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
>
>      /* feed decoder */
>      while (1) {
> -        if (s->ctx->current_input_buffer < 0) {
> +        if (s->ctx->current_input_buffer < 0 && !s->ctx->draining) {
>              /* poll for input space */
>              index = ff_AMediaCodec_dequeueInputBuffer(s->ctx->codec, 0);
>              if (index < 0) {

Other than my remark on the commit desc, LGTM.
Zhao Zhili Aug. 24, 2024, 3:06 p.m. UTC | #2
> On Aug 24, 2024, at 22:11, Matthieu Bouron <matthieu.bouron@gmail.com> wrote:
> 
> On Fri, Aug 23, 2024 at 7:20 PM Zhao Zhili <quinkblack@foxmail.com> wrote:
>> 
>> From: Zhao Zhili <zhilizhao@tencent.com>
>> 
>> There is no more buffer to queue in draining state
> 
> nit: There is no more input buffer to dequeue in draining state.

Actually I mean there is no more data to queue in draining state, so no point to dequeue
the input buffer, is it the right words?

> 
>> 
>> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
>> ---
>> libavcodec/mediacodecdec.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
>> index 6d8dc600fe..0da5fe6729 100644
>> --- a/libavcodec/mediacodecdec.c
>> +++ b/libavcodec/mediacodecdec.c
>> @@ -462,7 +462,7 @@ static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
>> 
>>     /* feed decoder */
>>     while (1) {
>> -        if (s->ctx->current_input_buffer < 0) {
>> +        if (s->ctx->current_input_buffer < 0 && !s->ctx->draining) {
>>             /* poll for input space */
>>             index = ff_AMediaCodec_dequeueInputBuffer(s->ctx->codec, 0);
>>             if (index < 0) {
> 
> Other than my remark on the commit desc, LGTM.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Matthieu Bouron Aug. 24, 2024, 3:56 p.m. UTC | #3
On Sat, Aug 24, 2024 at 5:07 PM Zhao Zhili <quinkblack@foxmail.com> wrote:
>
>
>
> > On Aug 24, 2024, at 22:11, Matthieu Bouron <matthieu.bouron@gmail.com> wrote:
> >
> > On Fri, Aug 23, 2024 at 7:20 PM Zhao Zhili <quinkblack@foxmail.com> wrote:
> >>
> >> From: Zhao Zhili <zhilizhao@tencent.com>
> >>
> >> There is no more buffer to queue in draining state
> >
> > nit: There is no more input buffer to dequeue in draining state.
>
> Actually I mean there is no more data to queue in draining state, so no point to dequeue
> the input buffer, is it the right words?

Maybe "no more packet to queue" (data is also fine). Whatever you prefer.

>
> >
> >>
> >> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
> >> ---
> >> libavcodec/mediacodecdec.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
> >> index 6d8dc600fe..0da5fe6729 100644
> >> --- a/libavcodec/mediacodecdec.c
> >> +++ b/libavcodec/mediacodecdec.c
> >> @@ -462,7 +462,7 @@ static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
> >>
> >>     /* feed decoder */
> >>     while (1) {
> >> -        if (s->ctx->current_input_buffer < 0) {
> >> +        if (s->ctx->current_input_buffer < 0 && !s->ctx->draining) {
> >>             /* poll for input space */
> >>             index = ff_AMediaCodec_dequeueInputBuffer(s->ctx->codec, 0);
> >>             if (index < 0) {
> >
> > Other than my remark on the commit desc, LGTM.
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 6d8dc600fe..0da5fe6729 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -462,7 +462,7 @@  static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
 
     /* feed decoder */
     while (1) {
-        if (s->ctx->current_input_buffer < 0) {
+        if (s->ctx->current_input_buffer < 0 && !s->ctx->draining) {
             /* poll for input space */
             index = ff_AMediaCodec_dequeueInputBuffer(s->ctx->codec, 0);
             if (index < 0) {