Reputation: 185
I created a test app for Flutter on Android TV that can play external streams via a streamingUrl. Initially loading the stream and playing it works fine.
The problem starts when I want to 'zap' through the different streams that are available by using the channel up/down buttons on the remote control. When doing this often, at a certain point the app will crash giving me nothing more than a 'tombstone' with a vague description of what went wrong.
I already tried the Flutter profiler to check if it is memory/performance related, but so far that does not seem to be the problem.
Also: there are devices with varying hardware specs on which this problem never occurs.
I'm using the Android Media3 library with some customizations to play the stream and handle DRM cases. So the playing of the stream is handled natively.
It seems that the Skia rendering engine wants to render a frame, but fails to do so, causing a crash at some point. But why and how this is happening is still a big mystery to me.
Can anyone help me by pointing me in the right direction to solve this issue, by answering one of the following questions:
The tombstone's stacktrace starts with this line:
2024-01-24 14:49:16.152 29103-29103 DEBUG crash_dump32 A signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xe675b014
The last method that was called and is readable looks like this:
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #05 pc 00646385 /vendor/lib/egl/libGLES_mali.so (eglCreateImageKHR+948) (BuildId: dfee92a81a346322de88278804aa7d5a)
The entire tombstone starting from the SIGSEGV looks like this:
2024-01-24 14:49:16.152 29103-29103 DEBUG crash_dump32 A signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xe675b014
2024-01-24 14:49:16.152 29103-29103 DEBUG crash_dump32 A r0 e675b000 r1 e675b001 r2 00000001 r3 00000001
2024-01-24 14:49:16.152 29103-29103 DEBUG crash_dump32 A r4 b7017600 r5 bcc47888 r6 00000001 r7 ccc555b0
2024-01-24 14:49:16.152 29103-29103 DEBUG crash_dump32 A r8 e7d48260 r9 bcc47984 r10 9bbc3968 r11 b7017600
2024-01-24 14:49:16.152 29103-29103 DEBUG crash_dump32 A ip bcc47838 sp bcc47870 lr e7cfc98b pc ccfcfd86
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #00 pc 0063dd86 /vendor/lib/egl/libGLES_mali.so (BuildId: dfee92a81a346322de88278804aa7d5a)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #01 pc 0063e39f /vendor/lib/egl/libGLES_mali.so (BuildId: dfee92a81a346322de88278804aa7d5a)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #02 pc 00640243 /vendor/lib/egl/libGLES_mali.so (BuildId: dfee92a81a346322de88278804aa7d5a)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #03 pc 0063ff09 /vendor/lib/egl/libGLES_mali.so (BuildId: dfee92a81a346322de88278804aa7d5a)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #04 pc 0063f95f /vendor/lib/egl/libGLES_mali.so (BuildId: dfee92a81a346322de88278804aa7d5a)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #05 pc 00646385 /vendor/lib/egl/libGLES_mali.so (eglCreateImageKHR+948) (BuildId: dfee92a81a346322de88278804aa7d5a)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #06 pc 00016e87 /system/lib/libEGL.so (void* android::eglCreateImageTmpl<int, void* (*)(void*, void*, unsigned int, void*, int const*)>(void*, void*, unsigned int, void*, int const*, void* (*)(void*, void*, unsigned int, void*, int const*))+310) (BuildId: 9c077f0f22a38f0ef41b19770721e8ec)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #07 pc 00016d43 /system/lib/libEGL.so (android::eglCreateImageKHRImpl(void*, void*, unsigned int, void*, int const*)+22) (BuildId: 9c077f0f22a38f0ef41b19770721e8ec)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #08 pc 002315f9 /system/lib/libhwui.so (GrAHardwareBufferUtils::MakeBackendTexture(GrContext*, AHardwareBuffer*, int, int, void (**)(void*), void**, bool, GrBackendFormat const&, bool)+136) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #09 pc 00231293 /system/lib/libhwui.so (_ZNSt3__110__function6__funcIZN31GrAHardwareBufferImageGenerator9makeProxyEP18GrRecordingContextE3$_0NS_9allocatorIS5_EEF5sk_spI9GrSurfaceEP18GrResourceProviderEEclEOSC_$2219a8229c88f20838122b4c217f5d45+70) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #10 pc 001e4b9b /system/lib/libhwui.so (GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider*)+70) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #11 pc 00196163 /system/lib/libhwui.so (GrResourceAllocator::addInterval(GrSurfaceProxy*, unsigned int, unsigned int)+322) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #12 pc 003dec5f /system/lib/libhwui.so (_ZNK12_GLOBAL__N_19TextureOp12visitProxiesERKNSt3__18functionIFvP14GrSurfaceProxyEEEN4GrOp11VisitorTypeE$ab67424b01b2ae857b75443a16f18610+90) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #13 pc 0019385d /system/lib/libhwui.so (GrRenderTargetOpList::OpChain::visitProxies(std::__1::function<void (GrSurfaceProxy*)> const&, GrOp::VisitorType) const+40) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #14 pc 001937a5 /system/lib/libhwui.so (GrRenderTargetOpList::gatherProxyIntervals(GrResourceAllocator*) const+116) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.297 29103-29103 DEBUG crash_dump32 A #15 pc 001fc6ff /system/lib/libhwui.so (GrDrawingManager::flush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess, GrFlushFlags, int, GrBackendSemaphore*, void (*)(void*), void*)+638) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.299 29103-29103 DEBUG crash_dump32 A #16 pc 001fc3f3 /system/lib/libhwui.so (GrDrawingManager::prepareSurfaceForExternalIO(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess, GrFlushFlags, int, GrBackendSemaphore*, void (*)(void*), void*)+118) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.299 29103-29103 DEBUG crash_dump32 A #17 pc 001fc2c9 /system/lib/libhwui.so (GrRenderTargetContext::prepareForExternalIO(SkSurface::BackendSurfaceAccess, GrFlushFlags, int, GrBackendSemaphore*, void (*)(void*), void*)+92) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.299 29103-29103 DEBUG crash_dump32 A #18 pc 001fc265 /system/lib/libhwui.so (SkGpuDevice::flush()+22) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.299 29103-29103 DEBUG crash_dump32 A #19 pc 001b8f87 /system/lib/libhwui.so (android::uirenderer::skiapipeline::SkiaPipeline::renderFrame(android::uirenderer::LayerUpdateQueue const&, SkRect const&, std::__1::vector<android::sp<android::uirenderer::RenderNode>, std::__1::allocator<android::sp<android::uirenderer::RenderNode>>> const&, bool, android::uirenderer::Rect const&, sk_sp<SkSurface>, SkMatrix const&)+146) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.299 29103-29103 DEBUG crash_dump32 A #20 pc 001b8ca1 /system/lib/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::draw(android::uirenderer::renderthread::Frame const&, SkRect const&, SkRect const&, android::uirenderer::LightGeometry const&, android::uirenderer::LayerUpdateQueue*, android::uirenderer::Rect const&, bool, android::uirenderer::LightInfo const&, std::__1::vector<android::sp<android::uirenderer::RenderNode>, std::__1::allocator<android::sp<android::uirenderer::RenderNode>>> const&, android::uirenderer::FrameInfoVisualizer*)+272) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.299 29103-29103 DEBUG crash_dump32 A #21 pc 001fa2d5 /system/lib/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+216) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.299 29103-29103 DEBUG crash_dump32 A #22 pc 001f98b1 /system/lib/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread13DrawFrameTask11postAndWaitEvE3$_0NS_9allocatorIS6_EEFvvEEclEv$c303f2d2360db58ed70a2d0ac7ed911b+176) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.299 29103-29103 DEBUG crash_dump32 A #23 pc 002050c3 /system/lib/libhwui.so (android::uirenderer::WorkQueue::process()+158) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.299 29103-29103 DEBUG crash_dump32 A #24 pc 00204f1b /system/lib/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+54) (BuildId: ab1701da2387beb5140b7e133cfadf83)
2024-01-24 14:49:16.299 29103-29103 DEBUG crash_dump32 A #25 pc 0000d903 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+182) (BuildId: 5033a2d0383ba79896a60621c50f40e1)
2024-01-24 14:49:16.299 29103-29103 DEBUG crash_dump32 A #26 pc 000a6087 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+20) (BuildId: f2641c48dc0dc78cb6357b8c19e46a43)
2024-01-24 14:49:16.299 29103-29103 DEBUG crash_dump32 A #27 pc 00060141 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) (BuildId: f2641c48dc0dc78cb6357b8c19e46a43)
Upvotes: 0
Views: 128
Reputation: 185
The solution was to use a lower quality stream. Apparently some devices don't like it when you feed them a high quality stream. So downgrading to 720p fixed the issue on the devices I'm currently testing on.
Upvotes: 0
Reputation: 99
Had a similar issue and the problem was that I was not releasing the player (calling player.release()) after each zap.
You say it's not a memory problem but may be give it a try.
Upvotes: 0