Opened 4 years ago

Last modified 18 months ago

#8865 reopened defect

Lost frames when decode by mediacodec

Reported by: jiyang Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: mediacodec regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

All code most sections same with doc/examples/hw_decode.c, I add mediacodec section, but when decode, I found always lost some frames.

How to reproduce:

    AVMediaCodecContext *mediacodec_ctx = av_mediacodec_alloc_context();
    av_mediacodec_default_init(decoder_ctx, mediacodec_ctx, surface);

    int eof = 0;
    while (1) {
        if (!eof) {
            ret = av_read_frame(input_ctx, &packet);
            LOGD("======= Read frame to packet: is_video: %d. %s =======",
                 packet.stream_index == video_stream,
                 av_err2str(ret));

            if (video_stream == packet.stream_index) {
                if (ret == AVERROR_EOF) {
                    eof = 1;
                    packet.data = NULL;
                    packet.size = 0;
                }
                double rq = av_q2d(video->time_base);
                LOGD("Packet: pts: %f, dts: %f", packet.pts * rq, packet.dts * rq);
                ret = avcodec_send_packet(decoder_ctx, &packet);
                LOGD("Send packet to decoder. %s", av_err2str(ret));
                if (ret == AVERROR(EAGAIN)) {
                    //
                } else if (ret < 0) {
                    break;
                }
            }
        }

        if (packet.stream_index == video_stream) {
            ret = decode_write(decoder_ctx, surface, frame, sw_frame, video);
            if (ret < 0) {
                break;
            }
        }

        av_packet_unref(&packet);
    }


static int decode_write(AVCodecContext *avctx, void *surface, AVFrame *frame, AVFrame *sw_frame,
                        AVStream *video_stream) {
    int ret = 0;

    while (1) {
        ret = avcodec_receive_frame(avctx, frame);
        LOGD("========= Receive frame from codec [%s] =========", av_err2str(ret));
        if (ret == AVERROR(EAGAIN)) {
            return 0;
        } else if (ret == AVERROR_EOF) {
            return ret;
        } else if (ret < 0) {
            return ret;
        }

        enum AVPixelFormat pixelFormat = (enum AVPixelFormat) (frame->format);
        double time_sec = frame->pts * av_q2d(video_stream->time_base);
        LOGD("Frame: %d, pts: %f, format: %s",
             avctx->frame_number,
             time_sec,
             av_get_pix_fmt_name(pixelFormat));

        int64_t time_nsec = time_sec * 1000000; // nanoseconds
        AVMediaCodecBuffer *mediaCodecBuffer = (AVMediaCodecBuffer *) frame->data[3];
        if (mediaCodecBuffer) {
            ret = av_mediacodec_render_buffer_at_time(mediaCodecBuffer, time_nsec);
            LOGD("Render buffer at %lld. %s", time_nsec, av_err2str(ret));
            av_frame_unref(frame);
        }
    }

    return ret;
}

Log:

D/HwDecode: Frame: 1, pts: 0.000000, format: mediacodec
D/HwDecode: Frame: 2, pts: 0.040000, format: mediacodec
D/HwDecode: Frame: 3, pts: 0.080000, format: mediacodec
D/HwDecode: Frame: 4, pts: 0.160000, format: mediacodec
D/HwDecode: Frame: 5, pts: 0.440000, format: mediacodec
D/HwDecode: Frame: 6, pts: 0.920000, format: mediacodec
D/HwDecode: Frame: 7, pts: 1.000000, format: mediacodec
D/HwDecode: Frame: 8, pts: 1.040000, format: mediacodec
D/HwDecode: Frame: 9, pts: 1.080000, format: mediacodec
D/HwDecode: Frame: 10, pts: 1.120000, format: mediacodec
D/HwDecode: Frame: 11, pts: 1.160000, format: mediacodec
D/HwDecode: Frame: 12, pts: 1.200000, format: mediacodec
D/HwDecode: Frame: 13, pts: 1.240000, format: mediacodec
D/HwDecode: Frame: 14, pts: 1.280000, format: mediacodec
D/HwDecode: Frame: 15, pts: 1.480000, format: mediacodec
D/HwDecode: Frame: 16, pts: 1.520000, format: mediacodec
D/HwDecode: Frame: 17, pts: 1.600000, format: mediacodec
D/HwDecode: Frame: 18, pts: 1.640000, format: mediacodec
D/HwDecode: Frame: 19, pts: 1.680000, format: mediacodec
D/HwDecode: Frame: 20, pts: 1.720000, format: mediacodec
D/HwDecode: Frame: 21, pts: 1.760000, format: mediacodec
D/HwDecode: Frame: 22, pts: 1.800000, format: mediacodec
D/HwDecode: Frame: 23, pts: 1.840000, format: mediacodec
D/HwDecode: Frame: 24, pts: 1.880000, format: mediacodec
D/HwDecode: Frame: 25, pts: 1.920000, format: mediacodec

Lost frames: [0.12, 0.22~0.4, 0.48~0.86, 0.96], and lost is random.

Change History (12)

comment:1 by jiyang, 4 years ago

packets return by av_read_frame is normal:

D: Packet: pts: 0.000000, dts: -0.040000
D: Packet: pts: 0.080000, dts: 0.000000
D: Packet: pts: 0.040000, dts: 0.040000
D: Packet: pts: 0.160000, dts: 0.080000
D: Packet: pts: 0.120000, dts: 0.120000
D: Packet: pts: 0.240000, dts: 0.160000
D: Packet: pts: 0.200000, dts: 0.200000
D: Packet: pts: 0.320000, dts: 0.240000
D: Packet: pts: 0.280000, dts: 0.280000
D: Packet: pts: 0.400000, dts: 0.320000
D: Packet: pts: 0.360000, dts: 0.360000
D: Packet: pts: 0.480000, dts: 0.400000
D: Packet: pts: 0.440000, dts: 0.440000
D: Packet: pts: 0.560000, dts: 0.480000
D: Packet: pts: 0.520000, dts: 0.520000
D: Packet: pts: 0.640000, dts: 0.560000
D: Packet: pts: 0.600000, dts: 0.600000
D: Packet: pts: 0.720000, dts: 0.640000
D: Packet: pts: 0.680000, dts: 0.680000
D: Packet: pts: 0.800000, dts: 0.720000
D: Packet: pts: 0.760000, dts: 0.760000
D: Packet: pts: 0.880000, dts: 0.800000
D: Packet: pts: 0.840000, dts: 0.840000
D: Packet: pts: 0.960000, dts: 0.880000
D: Packet: pts: 0.920000, dts: 0.920000
D: Packet: pts: 1.040000, dts: 0.960000
D: Packet: pts: 1.000000, dts: 1.000000
D: Packet: pts: 1.120000, dts: 1.040000
D: Packet: pts: 1.080000, dts: 1.080000
D: Packet: pts: 1.200000, dts: 1.120000
D: Packet: pts: 1.160000, dts: 1.160000
D: Packet: pts: 1.280000, dts: 1.200000
D: Packet: pts: 1.240000, dts: 1.240000
D: Packet: pts: 1.360000, dts: 1.280000
D: Packet: pts: 1.320000, dts: 1.320000
D: Packet: pts: 1.440000, dts: 1.360000
D: Packet: pts: 1.400000, dts: 1.400000
D: Packet: pts: 1.520000, dts: 1.440000
D: Packet: pts: 1.480000, dts: 1.480000
D: Packet: pts: 1.600000, dts: 1.520000
D: Packet: pts: 1.560000, dts: 1.560000
D: Packet: pts: 1.680000, dts: 1.600000
D: Packet: pts: 1.640000, dts: 1.640000
D: Packet: pts: 1.760000, dts: 1.680000
D: Packet: pts: 1.720000, dts: 1.720000
D: Packet: pts: 1.840000, dts: 1.760000
D: Packet: pts: 1.800000, dts: 1.800000
D: Packet: pts: 1.920000, dts: 1.840000
D: Packet: pts: 1.880000, dts: 1.880000
D: Packet: pts: 1.960000, dts: 1.920000

comment:2 by Carl Eugen Hoyos, 4 years ago

Priority: importantnormal

Is this issue not reproducible with ffmpeg, the command line utility?

comment:3 by jiyang, 4 years ago

I don't know how to use mediacodec with ffmpeg command line interface in Android Phone.

comment:4 by Benjamín de la Fuente Ranea, 19 months ago

Keywords: SurfaceTexture added

I'm having the same issue after trying to update ffmpeg in my android application from 3.4.2 to the latest stable version (currently 5.1.2). I've noticed that since ffmpeg 4.0 the decoding is not smooth and some frames are lost using mediacodec on Android. I've tested on 4 different devices with different versions of Android (7 and 9) and different chipsets (amlogic and rockchip) and the same thing happens to all of them.

In my application I'm using ffmpeg to decode a h264 video to a SurfaceTexture and use the texture in an OpenGL rendering context.

I've done a bisect and I've found the exact commit that produces this bad behaviour, the commit is: f611fef37cca44b89d0d7e6dfd1ac257736b5f7a

This is a sample log when the reproduction is not smooth. When the video resumes aftero some frames are lost you can see a meesage like this: "the latest buffer is 1985 old with packageName com.goldenrace.goldenviewer. Possible resume detected"

GoldenViewer        I  [ffmpeg] - ../events/fighting/0311_WD_001.mp4 - Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol
GoldenViewer        E  EGL_BAD_ATTRIBUTE: An unrecognized attribute or attribute value was passed in the attribute list.
GoldenViewer        I  [ffmpeg] - ../events/fighting/0311_WD_001.mp4 - Using surface 0x2576
GoldenViewer        I  [ffmpeg] - ../events/fighting/0311_WD_001.mp4 - Unsupported or unknown profile
VideoCapabilities   W  Unsupported mime video/dolby-vision
VideoCapabilities   W  Unsupported mime video/dolby-vision
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 1 line
VideoCapabilities   W  Unsupported mime video/dolby-vision
VideoCapabilities   W  Unrecognized profile/level 0/0 for video/mpeg2
VideoCapabilities   W  Unrecognized profile/level 0/2 for video/mpeg2
VideoCapabilities   W  Unrecognized profile/level 0/3 for video/mpeg2
VideoCapabilities   I  Unsupported profile 2 for video/mpeg2
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 2 lines
VideoCapabilities   I  Unsupported profile 2 for video/mpeg2
VideoCapabilities   I  Unsupported profile 3 for video/mpeg2
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 2 lines
VideoCapabilities   I  Unsupported profile 3 for video/mpeg2
VideoCapabilities   I  Unsupported profile 4 for video/mpeg2
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 2 lines
VideoCapabilities   I  Unsupported profile 4 for video/mpeg2
VideoCapabilities   I  Unsupported profile 5 for video/mpeg2
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 2 lines
VideoCapabilities   I  Unsupported profile 5 for video/mpeg2
VideoCapabilities   W  Unrecognized profile/level 1/32 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 2 for video/mp4v-es
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 6 lines
VideoCapabilities   I  Unsupported profile 2 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 4 for video/mp4v-es
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 6 lines
VideoCapabilities   I  Unsupported profile 4 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 8 for video/mp4v-es
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 6 lines
VideoCapabilities   I  Unsupported profile 8 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 16 for video/mp4v-es
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 6 lines
VideoCapabilities   I  Unsupported profile 16 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 32 for video/mp4v-es
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 6 lines
VideoCapabilities   I  Unsupported profile 32 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 64 for video/mp4v-es
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 6 lines
VideoCapabilities   I  Unsupported profile 64 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 128 for video/mp4v-es
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 6 lines
VideoCapabilities   I  Unsupported profile 128 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 256 for video/mp4v-es
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 6 lines
VideoCapabilities   I  Unsupported profile 256 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 512 for video/mp4v-es
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 6 lines
VideoCapabilities   I  Unsupported profile 512 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 1024 for video/mp4v-es
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 6 lines
VideoCapabilities   I  Unsupported profile 1024 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 2048 for video/mp4v-es
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 6 lines
VideoCapabilities   I  Unsupported profile 2048 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 4096 for video/mp4v-es
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 6 lines
VideoCapabilities   I  Unsupported profile 4096 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 8192 for video/mp4v-es
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 6 lines
VideoCapabilities   I  Unsupported profile 8192 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 16384 for video/mp4v-es
chatty              I  uid=10202(com.goldenrace.goldenviewer) SDLThread identical 6 lines
VideoCapabilities   I  Unsupported profile 16384 for video/mp4v-es
VideoCapabilities   I  Unsupported profile 4 for video/mp4v-es
OMXClient           I  IOmx service obtained
SurfaceUtils        D  connecting to surface 0xcd19c808, reason connectToSurface
MediaCodec          I  [OMX.amlogic.avc.decoder.awesome] setting surface generation to 21912577
SurfaceUtils        D  disconnecting from surface 0xcd19c808, reason connectToSurface(reconnect)
SurfaceUtils        D  connecting to surface 0xcd19c808, reason connectToSurface(reconnect)
MediaCodecLogger    I  [ASAP] HW.video.avc P2 + 7648730
ACodec              E  [OMX.amlogic.avc.decoder.awesome] setPortMode on output to DynamicANWBuffer failed w/ err -2147483648
MediaCodecLogger    I  [ASAP] HW.video.avc P2 - 7648736
MediaCodecLogger    D  Got amazon_media_codec_logger Service. Calling PID = 21399
MediaCodecLogger    I  [ASAP] HW.video.avc P3 + 7648736
<no-tag>            D  PlayerBase::stop() from IPlayer
AudioTrack          D  stop() called with 434826 frames delivered
<no-tag>            D  PlayerBase::stop() from IPlayer
AudioTrack          D  stop() called with 882 frames delivered
<no-tag>            D  PlayerBase::stop() from IPlayer
AudioTrack          D  stop() called with 882 frames delivered
<no-tag>            D  PlayerBase::stop() from IPlayer
AudioTrack          D  stop() called with 882 frames delivered
SurfaceUtils        D  disconnecting from surface 0xcd19c808, reason setNativeWindowSizeFormatAndUsage
SurfaceUtils        D  connecting to surface 0xcd19c808, reason setNativeWindowSizeFormatAndUsage
SurfaceUtils        D  set up nativeWindow 0xcd19c808 for 2208x1242, color 0x11, rotation 0, usage 0x402b00
ACodec              W  [OMX.amlogic.avc.decoder.awesome] setting nBufferCountActual to 9 failed: -1010
ACodec              W  [OMX.amlogic.avc.decoder.awesome] setting nBufferCountActual to 8 failed: -1010
MapperHal           W  buffer descriptor with invalid usage bits 0x2000
MapperHal           W  buffer descriptor with invalid usage bits 0x2000
MapperHal           W  buffer descriptor with invalid usage bits 0x2000
MapperHal           W  buffer descriptor with invalid usage bits 0x2000
MapperHal           W  buffer descriptor with invalid usage bits 0x2000
MapperHal           W  buffer descriptor with invalid usage bits 0x2000
MapperHal           W  buffer descriptor with invalid usage bits 0x2000
MediaCodecLogger    I  [ASAP] HW.video.avc P3 - 7649080
GoldenViewer        I  [ffmpeg] - ../events/fighting/0311_WD_001.mp4 - Output crop parameters top=0 bottom=1241 left=0 right=2207, resulting dimensions width=2208 height=1242
GoldenViewer        I  [ffmpeg] - ../events/fighting/0311_WD_001.mp4 - MediaCodec started successfully, ret = 0
MediaCodecLogger    I  [ASAP] HW.video.avc Got First Input Frame 7649109 pts:0
MediaCodecLogger    I  updateFormatChanged width = 2208 height = 1242
MediaCodecLogger    I  updatePTSTime [HW.video.avc] First PTS after Flush or reset = 0
MediaCodecLogger    I  [ASAP] HW.video.avc Got First Frame Ready 7649207(98)
GoldenViewer        I  [ffmpeg] - ../events/fighting/0311_WD_001.mp4 - Output MediaFormat changed to {crop-right=2207, color-format=17, slice-height=1242, mime=video/raw, hdr-static-info=java.nio.HeapByteBuffer[pos=0 lim=25 cap=25], stride=2208, color-standard=1, color-transfer=3, crop-bottom=1241, crop-left=0, width=2208, color-range=2, crop-top=0, height=1242}
GoldenViewer        I  [ffmpeg] - ../events/fighting/0311_WD_001.mp4 - Output crop parameters top=0 bottom=1241 left=0 right=2207, resulting dimensions width=2208 height=1242
MediaCodecLogger    I  [ASAP] HW.video.avc Got First Frame Render 7649214(105)
libperfstatsclient  I  start attempting to update service remote
libperfstatsclient  D  The service not found: amazonperfstats
MediaCodecLogger    I  App sets Timestamps for render in SurfaceFlinger
FrameEvents         E  updateAcquireFence: Did not find frame.
GoldenViewer        W  Performance peak! dt = 0.819950
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
MediaCodecLogger    I  the latest buffer is 4738 old with packageName com.goldenrace.goldenviewer. Possible resume detected
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
MediaCodecLogger    I  21399.HW.video.avc.bitrateInKbps = 5661
MediaCodecLogger    I  21399.HW.video.avc Resolution change from 0x0 to 2208x1242 took = 38
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
GoldenViewer        W  Performance peak! dt = 0.970315
MediaCodecLogger    I  the latest buffer is 1985 old with packageName com.goldenrace.goldenviewer. Possible resume detected
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
MediaCodecLogger    I  21399.HW.video.avc.bitrateInKbps = 7525
FrameEvents         E  updateAcquireFence: Did not find frame.
MediaCodecLogger    I  Flushing: 21399.HW.video.avc.framerate = 582.609 fps
MediaCodecLogger    I  updatePTSTime [HW.video.avc] First PTS after Flush or reset = 0
MediaCodecLogger    I  updatePTSTime Possible seek found! last pts:345000 cur pts:0
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
FrameEvents         E  updateAcquireFence: Did not find frame.
GoldenViewer        W  Performance peak! dt = 1.037560
MediaCodecLogger    I  the latest buffer is 4221 old with packageName com.goldenrace.goldenviewer. Possible resume detected
Last edited 19 months ago by Benjamín de la Fuente Ranea (previous) (diff)

comment:5 by Carl Eugen Hoyos, 19 months ago

Keywords: regression added; SurfaceTexture removed
Priority: normalimportant

Please confirm that the issue is reproducible with current FFmpeg git head, the only version supported on this bug tracker.

in reply to:  5 comment:6 by Benjamín de la Fuente Ranea, 19 months ago

Yes, this issue also happens on the latest ffmpeg commit on master branch.

Replying to Carl Eugen Hoyos:

Please confirm that the issue is reproducible with current FFmpeg git head, the only version supported on this bug tracker.

comment:7 by quinkblack, 18 months ago

I think it's the same bug fixed by this commit:

commit b1facd11a3cc00362949ea14d9eab30496cf0268

Author: Zhao Zhili <zhilizhao@tencent.com>

Date:   Wed Oct 19 10:38:41 2022 +0800



    avcodec/mediacodecdec: don't break out if both input and output port return try again

    

    At the beginning of decoding, if we feed mediacodec too fast, the

    input port will return try again. It takes some time for mediacodec

    to consume bitstream and output frame. So the output port also return

    try again. It possible that mediacodec_receive_frame doesn't consume

    any AVPacket and no AVFrame is output. Then both avcodec_send_packet()

    and avcodec_receive_frame() return EAGAIN, which shouldn't happen.

    

    This bug can be produced with decoding benchmark on Pixel 3.

Please test git master.

comment:8 by quinkblack, 18 months ago

I think it's the same bug fixed by this commit:

commit b1facd11a3cc00362949ea14d9eab30496cf0268

Author: Zhao Zhili <zhilizhao@tencent.com>

Date:   Wed Oct 19 10:38:41 2022 +0800



    avcodec/mediacodecdec: don't break out if both input and output port return try again

    

    At the beginning of decoding, if we feed mediacodec too fast, the

    input port will return try again. It takes some time for mediacodec

    to consume bitstream and output frame. So the output port also return

    try again. It possible that mediacodec_receive_frame doesn't consume

    any AVPacket and no AVFrame is output. Then both avcodec_send_packet()

    and avcodec_receive_frame() return EAGAIN, which shouldn't happen.

    

    This bug can be produced with decoding benchmark on Pixel 3.

Please test git master.

comment:9 by quinkblack, 18 months ago

I think it's the same bug fixed by this commit:

commit b1facd11a3cc00362949ea14d9eab30496cf0268

Author: Zhao Zhili <zhilizhao@tencent.com>

Date:   Wed Oct 19 10:38:41 2022 +0800



    avcodec/mediacodecdec: don't break out if both input and output port return try again

    

    At the beginning of decoding, if we feed mediacodec too fast, the

    input port will return try again. It takes some time for mediacodec

    to consume bitstream and output frame. So the output port also return

    try again. It possible that mediacodec_receive_frame doesn't consume

    any AVPacket and no AVFrame is output. Then both avcodec_send_packet()

    and avcodec_receive_frame() return EAGAIN, which shouldn't happen.

    

    This bug can be produced with decoding benchmark on Pixel 3.

Please test git master.

in reply to:  9 comment:10 by Benjamín de la Fuente Ranea, 18 months ago

You are right, the issue is gone with that commit, now it works properly in the last version of master branch.
Thanks

Replying to quinkblack:

I think it's the same bug fixed by this commit:

commit b1facd11a3cc00362949ea14d9eab30496cf0268

Author: Zhao Zhili <zhilizhao@tencent.com>

Date:   Wed Oct 19 10:38:41 2022 +0800



    avcodec/mediacodecdec: don't break out if both input and output port return try again

    

    At the beginning of decoding, if we feed mediacodec too fast, the

    input port will return try again. It takes some time for mediacodec

    to consume bitstream and output frame. So the output port also return

    try again. It possible that mediacodec_receive_frame doesn't consume

    any AVPacket and no AVFrame is output. Then both avcodec_send_packet()

    and avcodec_receive_frame() return EAGAIN, which shouldn't happen.

    

    This bug can be produced with decoding benchmark on Pixel 3.

Please test git master.

comment:11 by Carl Eugen Hoyos, 18 months ago

Resolution: fixed
Status: newclosed

Thank you for testing!

in reply to:  11 comment:12 by Benjamín de la Fuente Ranea, 18 months ago

Resolution: fixed
Status: closedreopened

I'm afraid I was wrong in my last tests and I was linking with the ffmpeg version that was working ok (3.4.12). I've tested again with master and the issue is already there. Sorry.

Replying to Carl Eugen Hoyos:

Thank you for testing!

Note: See TracTickets for help on using tickets.