Opened 6 years ago

Last modified 6 years ago

#13228 closed Developer Task

Miscellaneous Android fixes and improvements — at Version 11

Reported by: Peter Bennett Owned by: Peter Bennett
Priority: minor Milestone: 30.0
Component: Ports - Android Version: Master Head
Severity: medium Keywords:
Cc: Mark Spieth, gigem, jpoet Ticket locked: no

Description (last modified by Peter Bennett)

Android support is taking shape. Here is a list of issues to look into, with emphasis on Nvidia Shield / Android TV:

  • Exit from frontend causes a SEGFAULT. (Now Fixed)
  • The first startup hangs on white screen. Needs a splash screen?
  • Second startup hangs trying to locate the Myth Backend. Perhaps UPNP is not working? I solved it by manually creating the config.xml file. Check what is going on and if necessary set up the best way of doing this.
  • The shield remote does not have enough buttons. Add appropriate OSDs or menus to support all functions with the limited buttons available. Fix the bahaviour of the back button.
  • Support for Game controller buttons does not work correctly.
  • Green line at the bottom of the screen when watching video. See #13230
  • Digital audio is not working. There is only one audio device in the list, OpenSLES and setting up digital audio causes strange behavior.
  • When MythTV goes into the background, it should enter standby mode.
  • Remove Xvideo playback profiles that will not work.
  • Ensure default theme painter uses OpenGL.
  • Support hardware accelerated decode. See #13233
  • I noticed a white flash sometimes when navigating screens. Maybe the default background should be black not white.
  • If Android needs to terminate the app while it is in the background, make sure that is handled cleanly.
  • Make the real MythTV version known to Android. Currently, Android thinks the app is version 1.0.

Issues for Android Tablet and phone support:

  • better tablet/touchscreen support.
  • My screen map probably should have a transient overlay guide
  • better gesture support.
  • proper list flick scrolling

Change History (14)

comment:1 Changed 6 years ago by Peter Bennett

Exit from frontend causes a SEGFAULT

The destructor for the main window hits a segfault due to a null pointer, many levels deep in the destructor of QWidget. The destructor is not called twice. I cannot find a solution, so the workaround for now is bypass that on Android. This leaves a memory leak which is preferable to a Seg Fault. Note that even with bypassing the destructor, the Android log still contains messages about the window having died. See attached patch for the workaround (20180227_1059_android_segfault_workaround.patch). Next step in fixing this is to implement the correct Android method of closing an application, which may avoid the problem.

Changed 6 years ago by Peter Bennett

Workaround for segfault

comment:2 Changed 6 years ago by Peter Bennett

Green line at the bottom of the screen when watching video

Actually there is a green line at the bottom and side on some videos. I notice it on 720p or 480p videos when watching on a 1808p display.

The green line only occurs if it is using texture format YV12. There are two texture formats used for most systems - YV12 and UYVY. The logic for choosing which to use is rather obscure. It is choosing UYVU on regular Linux and choosing YV12 on Android. Testing shows that both formats work for Linux as well as for Android, but YV12 is causing the green line on Android. It seems to be a problem with the resizing algorithm. Changing to use UYVU on Android seems to solve the problem. See attached patch for the workaround (20180227_1100_android_greenline_workaround.patch)

Changed 6 years ago by Peter Bennett

Workaround for green line

comment:3 Changed 6 years ago by Peter Bennett

Status: newaccepted

comment:4 Changed 6 years ago by gigem

Description: modified (diff)

comment:5 in reply to:  1 Changed 6 years ago by Mark Spieth

Replying to pbennett:

Exit from frontend causes a SEGFAULT

The destructor for the main window hits a segfault due to a null pointer, many levels deep in the destructor of QWidget. The destructor is not called twice. I cannot find a solution, so the workaround for now is bypass that on Android. This leaves a memory leak which is preferable to a Seg Fault. Note that even with bypassing the destructor, the Android log still contains messages about the window having died. See attached patch for the workaround (20180227_1059_android_segfault_workaround.patch). Next step in fixing this is to implement the correct Android method of closing an application, which may avoid the problem.

I see at least 1 problem with the shutdown code in main() after exec exits. There is at least 1 deleteLater which requires the dispatcher to be running to process AFAIK. cleanup is called after the return when all the destructors are called. My bet is qApp is deleted before the call to DestroyMythMainWindow?. At the top of cleanup() flush/process the dispatcher queue one last time just in case. Also break on data (gdb) changed for the pointer thats causing the problem. Not that this issue is high priority.

comment:6 Changed 6 years ago by Peter Bennett

I validated, by setting a breakpoint at QApplication::~QApplication that it is not being deleted before DestroyMythMainWindow.

However, I have added a line to process the dispatcher queue and moved the DestroyMythMainWindow to the top of cleanup, now there is no more SEGFAULT :) :) !!!

Just adding the processEvents call without moving the DestroyMythMainWindow to the top still caused a SEGFAULT.

I also tested this on Linux and these changes do not cause a problem so they will not need a #ifdef around them.

See patch 20180227_1946_android_segfault.patch attached

Changed 6 years ago by Peter Bennett

Updated fix for seg fault

comment:7 Changed 6 years ago by Mark Spieth

If it works its a good solution. SHIPIT

comment:8 Changed 6 years ago by Mark Spieth

I suspect the green line(s) is due to YV12 having the Y part not divisible by 2 and the edge chroma is missing and the default is put in by ffmpeg? as green. I don't think this is gl's fault.

I have also noticed in interlaced images the right edge green has every 2nd pixel black and the others green.

Something sus going on here and may even be overrunning buffers.

comment:9 Changed 6 years ago by Stuart Auchterlonie

I like the segfault fix. :shipit:

comment:10 Changed 6 years ago by Peter Bennett <pbennett@…>

In 86647803f488a94f96b69bf942d867fe7e7a6710/mythtv:

android: Fix Seg Fault when exiting from mythfrontend

Refs #13228

comment:11 Changed 6 years ago by Peter Bennett

Description: modified (diff)
Note: See TracTickets for help on using tickets.