V4L2 loopback device as source for QML Camera component

System information:

  • NVIDIA Jetson Xavier NX (aarch64)
  • Qt 5.15 (qmake)
  • Cross compilaton using Qt Creator on Ubuntu 22.04

Problem Description:
I am using the Camera & VideoOutput QML components (https://doc.qt.io/qt-5/qml-qtmultimedia-camera.html & https://doc.qt.io/qt-5/qml-qtmultimedia-videooutput.html) together with a v4l2loopback device. I use this device as a sink in my GStreamer pipeline (v4l2sink) and as a source for the Camera QML component. Every few seconds I get this message:
CameraBin error: "Failed to allocate a buffer"

This is a block diagram of my GStreamer pipeline:

The video that is streamed into the v4l2sink is captured using the Camera QML component.
This is the code for the Camera QML component (the QML component Loader – named liveViewLoader – is not included in this code snippet as this is not relevant for the issue in my opinion):

import QtQuick 2.0
import QtMultimedia 5.15

Item
{
    /*
     * If the video stream does not exist on creation, the camera will never work.
     * The Component + Loader circumvents this by reloading the camera components after a timeout has occured.
     * The video device itself has to exist before the start, though.
     */
    id:             wrappingItem
    anchors.fill:   parent

    property string videoDeviceFile: "/dev/video2"
    Timer
    {
        id:         cameraTimeoutTimer
        interval:   1000 /* in ms */
        running:    false
        repeat:     false
        onTriggered:
        {
            liveViewLoader.restart();
        }
    }

    Component
    {
        id: liveViewComponent
        Item
        {
            height: wrappingItem.height
            width:  wrappingItem.width

            id: liveViewComponentItem

            Camera
            {
                id:             camera
                captureMode:    Camera.CaptureStillImage
                deviceId:       wrappingItem.videoDeviceFile
                onCameraStatusChanged:
                {
                    console.log("Live view camera state changed to", camera.cameraStatus)
                    var liveViewRunning = (camera.cameraStatus == Camera.ActiveStatus);
                    // If the camera changed state, but it's not running, set a timeout to restart the camera via the Loader.
                    cameraTimeoutTimer.start();
                    if ( liveViewRunning )
                    {
                        cameraTimeoutTimer.stop();
                    }
                }

                Component.onCompleted:
                {
                    checkAndHandleCameraAvailability();
                }
            }

            VideoOutput
            {
                id:             videoOutputArea
                source:         camera
                anchors.fill:   parent
                flushMode:      VideoOutput.EmptyFrame
                focus:          visible
            }

            function checkAndHandleCameraAvailability()
            {
                // If the selected camera is not available, the camera will automatically select a different camera that's available on the system. This is a workaround to disable that behavior.
                camera.deviceId = wrappingItem.videoDeviceFile

                let videoDeviceIsAvailable = (camera.deviceId === wrappingItem.videoDeviceFile);
                if (videoDeviceIsAvailable)
                    return;

                console.log("Camera is currently using video device", camera.deviceId)
                console.log("AvlStreamHandler.videoDeviceFile: ", AvlStreamHandler.videoDeviceFile)
                console.log("Video device", wrappingItem.videoDeviceFile, "is not available.")
                liveViewLoader.stop();
            }
        }
    }
}

Question:
Can anyone give me a hint why I get the “CameraBin error: “Failed to allocate a buffer”” error message and how this error could possibly be resolved?

Best regards

B0bbyR4y

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật