wang-bin / QtAV

A cross-platform multimedia framework based on Qt and FFmpeg. 基于Qt和FFmpeg的跨平台高性能音视频播放框架. Recommand to use new sdk https://github.com/wang-bin/mdk-sdk
http://qtav.org
3.99k stars 1.51k forks source link

Android QML opengl:true crash #469

Closed Ligverd closed 9 years ago

Ligverd commented 9 years ago

Didn't catch what the commit started the problem after QtAV 1.5. Target Android with QML If in QML not specified opengl or explicitly specify opengl:true then the program crash before starting playback. If you explicitly disable opengl:false it works.

Also if you use the Widget i.e. without QML everything works fine with opengl

At the start of playing with QML stable error

D/libtest_qtav.so(30651): /home/kid/projects/QtAV/src/VideoShader.cpp:472 (void QtAV::VideoMaterial::setCurrentFrame(const QtAV::VideoFrame&)): "pixel format changed:  => yuv420p"
F/libtest_qtav.so(30651): (null):0 ((null)): ASSERT failure in QVector<T>::operator[]: "index out of range", file /opt/qt5/android_arm/include/QtCore/qvector.h, line 392
F/libc    (30651): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 30743 (QSGRenderThread)

qml/SGVideoNode.cpp ?

wang-bin commented 9 years ago

please use VideoOutput2. VideoOutput crashes sometimes and I haven't tested it for a long time.

Ligverd commented 9 years ago

Thanks VideoOutput2 helped, now not falling.

Compared 1.4 video jittery played , I didn't use avShift i.e. did build a clean master branch. I use Qt 5.4.1 ffmpeg 2.6.1 openAL 1.16.0

This is a known issue or problem with me?

Now try different versions QtAV ranging from 1.4 and ffmpeg from 2.2.1 By results I will unsubscribe.

wang-bin commented 9 years ago

does 1.4 play smoothly?

Ligverd commented 9 years ago

Don't even know what to say.

v1.4 not very "friendly" openAL and this test I think is not correct.

Now in the master branch when building APK using QML in the package is not placed libQt5OpenGL.so we have to *.pro file do LIBS += Qt5OpenGL

But the difference is I didn't notice.

Here is the output QML application, greep OpenGL

...
D/dalvikvm( 4820): Trying to load lib /data/data/org.qtproject.example.test_qtav/lib/libQt5OpenGL.so 0x41623b30
D/dalvikvm( 4820): Added shared lib /data/data/org.qtproject.example.test_qtav/lib/libQt5OpenGL.so 0x41623b30
...
D/libEGL  ( 4820): loaded /system/lib/egl/libEGL_mali.so
D/libEGL  ( 4820): loaded /system/lib/egl/libGLESv1_CM_mali.so
D/libEGL  ( 4820): loaded /system/lib/egl/libGLESv2_mali.so
D/OpenGLRenderer( 4820): Enabling debug mode 0
...
W/Qt A11Y ( 4820): Could not activate platform accessibility.
D/libEGL  ( 4820): loaded /system/lib/egl/libEGL_mali.so
D/libEGL  ( 4820): loaded /system/lib/egl/libGLESv1_CM_mali.so
D/libEGL  ( 4820): loaded /system/lib/egl/libGLESv2_mali.so
D/OpenGLRenderer( 4820): Enabling debug mode 0
...
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:421 (virtual void QtAV::VideoShader::compile(QOpenGLShaderProgram*)): "bind attribute: a_Position => 0"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:421 (virtual void QtAV::VideoShader::compile(QOpenGLShaderProgram*)): "bind attribute: a_TexCoords0 => 1"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:270 (virtual void QtAV::VideoShader::initialize(QOpenGLShaderProgram*)): "glGetUniformLocation("u_Texture0") = 1"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:270 (virtual void QtAV::VideoShader::initialize(QOpenGLShaderProgram*)): "glGetUniformLocation("u_Texture1") = 2"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:270 (virtual void QtAV::VideoShader::initialize(QOpenGLShaderProgram*)): "glGetUniformLocation("u_Texture2") = 3"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:272 (virtual void QtAV::VideoShader::initialize(QOpenGLShaderProgram*)): "glGetUniformLocation("u_MVP_matrix") = 0"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:273 (virtual void QtAV::VideoShader::initialize(QOpenGLShaderProgram*)): "glGetUniformLocation("u_colorMatrix") = 4"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:274 (virtual void QtAV::VideoShader::initialize(QOpenGLShaderProgram*)): "glGetUniformLocation("u_opacity") = 5"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:973 (bool QtAV::VideoMaterialPrivate::ensureResources()): "plane linesize 0: padded = 736, effective = 704"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:974 (bool QtAV::VideoMaterialPrivate::ensureResources()): "plane width 736: effective = 704"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:975 (bool QtAV::VideoMaterialPrivate::ensureResources()): "planeHeight 0 = 576"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:973 (bool QtAV::VideoMaterialPrivate::ensureResources()): "plane linesize 1: padded = 368, effective = 352"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:974 (bool QtAV::VideoMaterialPrivate::ensureResources()): "plane width 368: effective = 352"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:975 (bool QtAV::VideoMaterialPrivate::ensureResources()): "planeHeight 1 = 288"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:973 (bool QtAV::VideoMaterialPrivate::ensureResources()): "plane linesize 2: padded = 368, effective = 352"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:974 (bool QtAV::VideoMaterialPrivate::ensureResources()): "plane width 368: effective = 352"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:975 (bool QtAV::VideoMaterialPrivate::ensureResources()): "planeHeight 2 = 288"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:995 (bool QtAV::VideoMaterialPrivate::ensureResources()): "effective_tex_width_ratio=0.956522"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:859 (bool QtAV::VideoMaterialPrivate::updateTextureParameters(const QtAV::VideoFormat&)): "///////////bpp 2"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:888 (bool QtAV::VideoMaterialPrivate::updateTextureParameters(const QtAV::VideoFormat&)): "texture width: 736 - 704 = pad: 32. bpp(gl): 1"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:888 (bool QtAV::VideoMaterialPrivate::updateTextureParameters(const QtAV::VideoFormat&)): "texture width: 368 - 352 = pad: 16. bpp(gl): 1"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:888 (bool QtAV::VideoMaterialPrivate::updateTextureParameters(const QtAV::VideoFormat&)): "texture width: 368 - 352 = pad: 16. bpp(gl): 1"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:1033 (bool QtAV::VideoMaterialPrivate::ensureTextures()): "creating texture for plane 0"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:1041 (bool QtAV::VideoMaterialPrivate::ensureTextures()): "texture for plane 0 is created (id=9)"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:1033 (bool QtAV::VideoMaterialPrivate::ensureTextures()): "creating texture for plane 1"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:1041 (bool QtAV::VideoMaterialPrivate::ensureTextures()): "texture for plane 1 is created (id=10)"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:1033 (bool QtAV::VideoMaterialPrivate::ensureTextures()): "creating texture for plane 2"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/VideoShader.cpp:1041 (bool QtAV::VideoMaterialPrivate::ensureTextures()): "texture for plane 2 is created (id=11)"
D/libtest_qtav.so( 4820): /home/kid/projects/QtAV/src/OpenGLVideo.cpp:183 (void QtAV::OpenGLVideoPrivate::bindAttributes(QtAV::VideoShader*, const QRectF&, const QRectF&)): "VAO is not supported"
...

Okay I will not distract you from important things, I will understand itself.

wang-bin commented 9 years ago

you don't need opengl module for qml app. qt5 gui module has fully support for opengl. opengl module is just for compatibility and will be removed in the future. I uploaded QMLPlayer apk http://sourceforge.net/projects/qtav/files/ci/QtAV1.7.0alpha-QMLPlayer-android-armv7-signed.apk/download It plays fine on my Nexus7.

Here is the output QML application, greep OpenGL

what's your problem?

Ligverd commented 9 years ago

For OpenGL thanks, didn't know.

Tried QMLPLayer played a local file Nexus 5 good Nexus 7 good Samsung Galaxy Tab P5110 sound twitches video jerks Wexler Tab sound twitches video jerks

On my test applications Samsung P5110

Here are twitching every 1-2 seconds

AVPlayer {
    id: mediaplayer
    autoPlay: true
    source: "file:///VIDEOFILE"
}

VideoOutput2 {
    source: mediaplayer
}

Here all goes smoothly only the sound stops shaking only after setBufferCount(16)

vo = new VideoOutput(this);
player->setRenderer(vo);
player->play("file:///VIDEOFILE");

Old hardware?

wang-bin commented 9 years ago

Audio should be smooth. I think it's audio code. what's your video resolution and bitrate? what about lower resolution and bitrate? Because QtAV does not support gpu decoder now, the playback will not be smooth for large videos

Ligverd commented 9 years ago

The question is not what smoothly or not smoothly in QtAV But the fact that if you play through the widget the smoothness fine with me if the same file/stream to play using QtQuick (QML) then begins to twitch.

Ligverd commented 9 years ago

I close the issue, because with the fall of the player like decided.