Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#13228 closed Developer Task (Fixed)

Miscellaneous Android fixes and improvements

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. See #13228
  • The first startup hangs on white screen. Needs a splash screen? See #13237
  • 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. See #13234
  • 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. see comment:17
  • When MythTV goes into the background, it should enter standby mode.
  • Remove Xvideo playback profiles that will not work. See #13250
  • Ensure default theme painter uses OpenGL. See #13243
  • 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. See #13246

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

Attachments (3)

20180227_1059_android_segfault_workaround.patch (534 bytes) - added by Peter Bennett 6 years ago.
Workaround for segfault
20180227_1100_android_greenline_workaround.patch (960 bytes) - added by Peter Bennett 6 years ago.
Workaround for green line
20180227_1946_android_segfault.patch (594 bytes) - added by Peter Bennett 6 years ago.
Updated fix for seg fault

Download all attachments as: .zip

Change History (28)

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)

comment:12 Changed 6 years ago by Peter Bennett

Description: modified (diff)

comment:13 Changed 6 years ago by gigem

Description: modified (diff)

comment:14 Changed 6 years ago by gigem

Description: modified (diff)

comment:15 Changed 6 years ago by gigem

Description: modified (diff)

comment:16 Changed 6 years ago by gigem

Description: modified (diff)

comment:17 Changed 6 years ago by Peter Bennett

Digital audio does work on the NVidia Shield.

If you have a surround sound receiver that does Dolby Digital-

Go into the Shield setup, Display & Sound, Advanced Settings, Surround Sound - set to Always. It seems that setting it to Auto is the same as Setting it to Never.

Go into MythTV, Setup, Audio. Select Digital Audio Capabilities, check Dolby Digital. Now you can select Speakers as 5.1. You can also select Upconvert Stereo to 5.1 surround, although I do not normally use that.

Now recordings play back Dolby surround through the sound system. Also stereo channels show as Dolby surround if you selected the upconvert. There is not that clicking sound we had before.

comment:18 Changed 6 years ago by Peter Bennett

Description: modified (diff)

comment:19 Changed 6 years ago by Peter Bennett

Owner: changed from Peter Bennett to Peter Bennett
Status: acceptedassigned

comment:20 Changed 6 years ago by Peter Bennett

Description: modified (diff)

comment:21 Changed 6 years ago by Mark Spieth <mspieth@…>

In ba5348819/mythtv:

Android: Add standard library check for opengl

refs #13228

comment:22 Changed 6 years ago by Mark Spieth <mspieth@…>

In ba5348819/mythtv:

Android: Add standard library check for opengl

refs #13228

comment:23 Changed 6 years ago by Mark Spieth <mspieth@…>

In ba5348819/mythtv:

Android: Add standard library check for opengl

refs #13228

comment:24 Changed 5 years ago by Peter Bennett

Resolution: Fixed
Status: assignedclosed

comment:25 Changed 5 years ago by Mark Spieth <mspieth@…>

In ab9650473/packaging:

Android: Support cmake > 3.9 for lib builds

refs #13228

Note: See TracTickets for help on using tickets.