willforde / script.module.codequick

Kodi addon framework
GNU General Public License v2.0
33 stars 6 forks source link

Long delay during navigation when go back #16

Closed sy6sy2 closed 6 years ago

sy6sy2 commented 6 years ago

Hi willforde,

A user of our Addon notice that when he go back from any of our addon menu, the delay is as long as when he go forward in a level. This delay is very short when using the addon in a good computer but I just tested it in my old Raspberry Pi and I can reproduce the problem.

I understand the delay in forward navigation (because we have to build the Menu listing) but why there is a delay in backward navigation?

I also tested with one of your addon using codequick and the problem is the same.

BUT, by testing the same behavior with the official Youtube addon on my old RB, I can see that the loading time is long to enter in a menu, but if I go back there is no delay and the previous menu show up instantly.

Thank you for your help,

Sylvain

PS: Maybe do you want logs?

Edit:

This is the time between the key pressed and the menu on the screen:

Logs

[Currently in level 2 ; press on backspace to go back at root menu ]

13:11:05.116 T:1944391792   DEBUG: OnKey: backspace (0xf008) pressed, action is Back
13:11:05.117 T:1914205088    INFO: CActiveAESink::OpenSink - initialize sink
13:11:05.118 T:1914205088   DEBUG: CActiveAESink::OpenSink - trying to open device PI:HDMI
13:11:05.118 T:1914205088   DEBUG: CAESinkPi:Initialize Format:15 Channels:2 Samplerate:44100 framesize:8 bufsize:17640 bytes/s=352800.00 dest=PI:HDMI
13:11:05.120 T:1914205088   DEBUG: CAESinkPi:SetAudioProps hdmi_stream_channels 0 hdmi_channel_map 00000008
13:11:05.126 T:1914205088   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.audio_render input port 100 output port 100 m_handle 0x49a6030
13:11:05.131 T:1914205088   DEBUG: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.audio_render) - port(100), nBufferCountMin(1), nBufferCountActual(2), nBufferSize(17648), nBufferAlignmen(16)
13:11:05.133 T:1914205088   DEBUG: CActiveAESink::OpenSink - SinkPi Initialized:
13:11:05.133 T:1914205088   DEBUG:   Output Device : HDMI
13:11:05.134 T:1914205088   DEBUG:   Sample Rate   : 44100
13:11:05.134 T:1914205088   DEBUG:   Sample Format : AE_FMT_FLOAT
13:11:05.134 T:1914205088   DEBUG:   Channel Count : 2
13:11:05.134 T:1914205088   DEBUG:   Channel Layout: FL,FR
13:11:05.134 T:1914205088   DEBUG:   Frames        : 2205
13:11:05.135 T:1914205088   DEBUG:   Frame Size    : 8
13:11:05.139 T:1944391792   DEBUG: CGUIMediaWindow::GetDirectory (plugin://plugin.video.science.friday/)
13:11:05.140 T:1944391792   DEBUG:   ParentPath = [plugin://]
13:11:05.164 T:1647309728   DEBUG: CAddonDatabase::SetLastUsed[plugin.video.science.friday] took 24 ms
13:11:05.166 T:1521480608   DEBUG: StartScript - calling plugin Science Friday('plugin://plugin.video.science.friday/','27','')
13:11:05.169 T:1513092000   DEBUG: Thread LanguageInvoker start, auto delete: false
13:11:05.172 T:1513092000    INFO: initializing python engine.
13:11:05.172 T:1513092000   DEBUG: CPythonInvoker(32, /storage/.kodi/addons/plugin.video.science.friday/addon.py): start processing
13:11:05.355 T:1513092000   DEBUG: -->Python Interpreter Initialized<--
13:11:05.356 T:1513092000   DEBUG: CPythonInvoker(32, /storage/.kodi/addons/plugin.video.science.friday/addon.py): the source file to load is "/storage/.kodi/addons/plugin.video.science.friday/addon.py"
13:11:05.363 T:1513092000   DEBUG: CPythonInvoker(32, /storage/.kodi/addons/plugin.video.science.friday/addon.py): setting the Python path to /storage/.kodi/addons/plugin.video.science.friday:/storage/.kodi/addons/script.module.addon.signals/lib:/storage/.kodi/addons/script.module.codequick/lib:/storage/.kodi/addons/script.module.htmlement/lib:/storage/.kodi/addons/script.module.youtube.dl/lib:/usr/lib/python27.zip:/usr/lib/python2.7:/usr/lib/python2.7/plat-linux2:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload:/usr/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages/gtk-2.0
13:11:05.363 T:1513092000   DEBUG: CPythonInvoker(32, /storage/.kodi/addons/plugin.video.science.friday/addon.py): entering source directory /storage/.kodi/addons/plugin.video.science.friday
13:11:05.364 T:1513092000   DEBUG: CPythonInvoker(32, /storage/.kodi/addons/plugin.video.science.friday/addon.py): instantiating addon using automatically obtained id of "plugin.video.science.friday" dependent on version 2.25.0 of the xbmc.python api
13:11:05.662 T:1944391792   DEBUG: ------ Window Init (DialogBusy.xml) ------
13:11:07.352 T:1513092000   DEBUG: [Science-Friday.support] Dispatching to route: 'root'
13:11:07.361 T:1513092000   DEBUG: [Science-Friday.support] Callback parameters: '{}'
13:11:07.442 T:1513092000   DEBUG: [urlquick] Requesting resource: https://www.sciencefriday.com/explore/
13:11:07.446 T:1513092000   DEBUG: [urlquick] Request headers: {u'Host': u'www.sciencefriday.com', u'Accept-language': u'en-gb,en-us,en', u'Connection': u'keep-alive', u'Accept': u'*/*', u'Accept-Encoding': u'gzip, deflate'}
13:11:07.472 T:1513092000   DEBUG: [urlquick] Cache is fresh, returning cached response
13:11:13.541 T:1513092000   DEBUG: [Science-Friday.route] Content-type: files
13:11:13.577 T:1513092000   DEBUG: [Science-Friday.support] Route Execution Time: 6191ms
13:11:13.581 T:1513092000   DEBUG: [Science-Friday.support] Total Execution Time: 8182ms
13:11:13.581 T:1513092000    INFO: CPythonInvoker(32, /storage/.kodi/addons/plugin.video.science.friday/addon.py): script successfully run
13:11:13.686 T:1504703392   DEBUG: Thread BackgroundLoader start, auto delete: false
13:11:13.757 T:1944391792   DEBUG: Keyboard: scancode: 0x0e, sym: 0x0008, unicode: 0x0008, modifier: 0x0
13:11:13.793 T:1857024928   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.image_decode input port 320 output port 321 m_handle 0x5e9e2fa8
13:11:13.798 T:1857024928   DEBUG: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.image_decode) - port(320), nBufferCountMin(2), nBufferCountActual(2), nBufferSize(127904), nBufferAlignmen(16)
13:11:13.822 T:1857024928   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.egl_render input port 220 output port 221 m_handle 0x5e9b0448
13:11:13.833 T:1857024928   DEBUG: COMXCoreComponent::UseEGLImage component(OMX.broadcom.egl_render) - port(221), nBufferCountMin(1), nBufferCountActual(1), nBufferSize(15360) nBufferAlignmen(16)
13:11:13.872 T:1857024928   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.image_decode handle 0x5e9e2fa8
13:11:13.883 T:1857024928   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.egl_render handle 0x5e9b0448
13:11:13.884 T:1857024928   DEBUG: DecodeJpegToTexture: decoded special://masterprofile/Thumbnails/3/3d3c815e.jpg 1280x720
13:11:13.885 T:1857024928   DEBUG: DoWork - took 108 ms to load special://masterprofile/Thumbnails/3/3d3c815e.jpg
13:11:14.088 T:1504703392   DEBUG: Thread BackgroundLoader 1504703392 terminating
13:11:14.143 T:1944391792   DEBUG: ------ Window Deinit (DialogBusy.xml) ------
13:11:14.473 T:1513092000    INFO: Python script stopped
13:11:14.473 T:1513092000   DEBUG: Thread LanguageInvoker 1513092000 terminating
[Currently in level 2 ; press on backspace to go back at root menu ]

13:12:51.096 T:1944391792   DEBUG: OnKey: backspace (0xf008) pressed, action is Back
13:12:51.101 T:1944391792   DEBUG: CGUIMediaWindow::GetDirectory (plugin://plugin.video.youtube/)
13:12:51.101 T:1944391792   DEBUG:   ParentPath = [plugin://plugin.video.youtube/]
13:12:51.114 T:1944391792   DEBUG: Loading items: 8, directory: plugin://plugin.video.youtube/ sort method: 0, ascending: false
13:12:51.490 T:1647309728   DEBUG: CAddonDatabase::SetLastUsed[plugin.video.youtube] took 389 ms
13:12:51.504 T:1857024928   DEBUG: Thread JobWorker start, auto delete: true
13:12:51.522 T:1513092000   DEBUG: Thread BackgroundLoader start, auto delete: false
13:12:51.568 T:1944391792   DEBUG: Keyboard: scancode: 0x0e, sym: 0x0008, unicode: 0x0008, modifier: 0x0
13:12:51.590 T:1647309728   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.image_decode input port 320 output port 321 m_handle 0x47d3f18
13:12:51.593 T:1647309728   DEBUG: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.image_decode) - port(320), nBufferCountMin(2), nBufferCountActual(2), nBufferSize(81920), nBufferAlignmen(16)
13:12:51.612 T:1647309728   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.egl_render input port 220 output port 221 m_handle 0x4aaffe8
13:12:51.615 T:1647309728   DEBUG: COMXCoreComponent::UseEGLImage component(OMX.broadcom.egl_render) - port(221), nBufferCountMin(1), nBufferCountActual(1), nBufferSize(15360) nBufferAlignmen(16)
13:12:51.651 T:1647309728   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.image_decode handle 0x47d3f18
13:12:51.657 T:1647309728   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.egl_render handle 0x4aaffe8
13:12:51.660 T:1647309728   DEBUG: DecodeJpegToTexture: decoded special://masterprofile/Thumbnails/3/3030a3d3.jpg 1280x720
13:12:51.674 T:1857024928   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.image_decode input port 320 output port 321 m_handle 0x5e9e2fa8
13:12:51.679 T:1857024928   DEBUG: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.image_decode) - port(320), nBufferCountMin(2), nBufferCountActual(2), nBufferSize(81920), nBufferAlignmen(16)
13:12:51.692 T:1857024928   DEBUG: COMXCoreComponent::Initialize OMX.broadcom.egl_render input port 220 output port 221 m_handle 0x72b10bb0
13:12:51.702 T:1857024928   DEBUG: COMXCoreComponent::UseEGLImage component(OMX.broadcom.egl_render) - port(221), nBufferCountMin(1), nBufferCountActual(1), nBufferSize(15360) nBufferAlignmen(16)
13:12:51.724 T:1857024928   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.image_decode handle 0x5e9e2fa8
13:12:51.734 T:1857024928   DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.egl_render handle 0x72b10bb0
13:12:51.737 T:1857024928   DEBUG: DecodeJpegToTexture: decoded special://masterprofile/Thumbnails/6/672681e1.jpg 256x256
13:12:51.806 T:1513092000   DEBUG: Thread BackgroundLoader 1513092000 terminating

We can notice that in the Youtube addon the addon in not executed in the backspace case. This is not the case in the Sciences Friday addon, we can see that the addon is executed.

Do you no why?

cc @wwark

willforde commented 6 years ago

Dam. I didn't know that it was that bad. I set cache_to_disc to False a while back due to some unpredictable behaviour. I will set it back to True by default and see how it goes.

willforde commented 6 years ago

By the way if can still be disabled again by doing plugin.cache_to_disc = False if you have a need for it.

sy6sy2 commented 6 years ago

Thank you for your answer, I will try it on the Raspberry to see the difference ;-)

Do I need to add plugin.cache_to_disc = True on each Route function?

willforde commented 6 years ago

No. That's just how you would have enabled it before. It is set to True by default now.

sy6sy2 commented 6 years ago

Yes I understand that you modified it on your last commit, but how to do to set it to True by default with the current CodeQuick version on Kodi repo?

willforde commented 6 years ago

Yes. With the current version on Kodi you will have to do plugin.cache_to_disc = True on every Route function.

sy6sy2 commented 6 years ago

Okay, thanks for the precision. I will test that!

sy6sy2 commented 6 years ago

Perfect! This is better on my old Raspberry, at least for the "back" action ;-)