Closed kimvnhung closed 3 months ago
Thanks for the report.
Does it mean that frame()
returns nullptr there?
Could you test https://github.com/valbok/QtAVPlayer/blob/master/src/QtAVPlayer/qavhwdevice_d3d11.cpp#L324
if (!frame().frame())
return {};
I tried your test but frame() is not nullptr, The problem occurred on this line: return QLatin1String(av_pix_fmt_desc_get(QAVVideoFrame::format())->name); And I saw that QAVVideoFrame::format() return -1 at that.
I tried 2 simillar samples with QVideoWidget and QGraphicsVideoItem, It both contains a videoSink. The sample with QVideoWidget worked fine, But the sample with QGraphicsVideoItem crashed on the line above after call to play()
could you qDebug() << frame().frame()->format; ?
Is it -1?
Yes, It prints -1, but with the QVideoWidget, It prints 172. I think It has some difference between QVideoSink in QVideoWidget and in QGraphicsVideoItem. But I'm not sure
Note: I used the same rtsp link with both case
Forgot to ask, static_cast<bool>(frame())
should be false there?
Meant that the frame is invalid and should be skipped
Sorry, I dont know where is the "static_cast(frame())" you mentioned I'm using Qt 6.6.2 which has a defined for handling
meant to check like if (!frame()) qDebug() <<"empty frame";
It's empty frame...
log
so could you please just skip it?
if (!frame())
return {};
And check if some correct video frames will be sent? Also could you provide std output? Maybe it could not find a codec...
Oh, ok, It works fine now with QGraphicsVideoItem. Thanks for your support
I tried widget_video sample and run successfully. But while I try to use QGraphicsVideoItem to show video inside a QGraphicsView, the app crashed.
This is the debug mode last point before crashing 1 QAVVideoFrame::formatName qavvideoframe.cpp 140 0x7ff7b1429978 2 VideoBuffer_D3D11::handle qavhwdevice_d3d11.cpp 325 0x7ff7b14c9fc2 3 QAVVideoFrame::handle qavvideoframe.cpp 123 0x7ff7b142990e 4 PlanarVideoBuffer::mapTextures qavvideoframe.cpp 312 0x7ff7b142f527
This is how I use QGraphicsVideoItem to show video