Skip to content

On iOS devices, rendering of videotoolbox decoded frames stops after 30000 frames. #388

@geminixdev

Description

@geminixdev

Qt 6.4.3 and Qt 6.5.2, on iOS devices, real devices:

Decoding works fine, decoded frames are AV_PIX_FMT_VIDEOTOOLBOX.
When sending to display using videoSink->setVideoFrame(), they are redeclared (not converted) to NV12 in the code of QtAVPlayer in QAVVideoFrame::operator QVideoFrame() :

        ...
        case AV_PIX_FMT_D3D11:
        case AV_PIX_FMT_VIDEOTOOLBOX:
        case AV_PIX_FMT_NV12:
            format = VideoFrame::Format_NV12;
            break;
        ...

Then they are taken for display by videoSink->setVideoFrame().

Works fine, plays smooth on iPad and iPhone. Looks perfect!

But after 20 minutes or apparently exactly 30000 frames fed into videoSink->setVideoFrame() the displayed picture and the complete UI is freezing, but not due to something hogging CPU (CPU usage drops significantly).

Now there is only about one UI update per minute, or per two minutes, happening. The UI is unresponsive, but the player continues to play, QtAVPlayer delivers audio and video frames, the audio continues to play, only the pictures are not updated.

Different to running on iOS simulator or Mac the memory usage is increasing slowly up until the freezing. But the freezing occurs at the 30000 frames mark, and not when a certain memory threshold is reached. It freezes also no matter if HD or SD video is played.

When sending dummy frames like this:

videoSink->setVideoFrame(QVideoFrame());

then there is no freeze, and memory usage increases significantly less.

When converting the AV_PIX_FMT_VIDEOTOOLBOX frames to AV_PIX_FMT_YUV420P or AV_PIX_FMT_NV12 before displaying with

convertTo(AV_PIX_FMT_YUV420P);

or

convertTo(AV_PIX_FMT_NV12);

which results in displaying these frames as software frames, then there is also no freeze (but the display is jerky, too slow, so that is unfortunately not a workaround).

So this seems to be quite clearly a problem in QtMM videoSink->setVideoFrame(). However when using QtMM alone, directly, the QtMM black box mediaplayer, then there is no freeze, at least not with Qt 5, it plays for hours and smooth.

The question is now, is there something special to consider when sending the AV_PIX_FMT_VIDEOTOOLBOX frames to setVideoFrame()? May be they need not to be relabelled as NV12, but as something different?

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions