kiall / android-tvheadend

Android + TV Headend + TV Input Framework
Apache License 2.0
192 stars 61 forks source link

Channels never load if the HTSP connection takes too long to establish #201

Closed girlpunk closed 7 years ago

girlpunk commented 7 years ago
java.lang.NullPointerException: Attempt to invoke virtual method 'int ie.macinnes.htsp.HtspMessage.getInteger(java.lang.String, int)' on a null object reference
        at ie.macinnes.htsp.tasks.Subscriber.subscribe(Subscriber.java:149)
        at ie.macinnes.htsp.tasks.Subscriber.onAuthenticationStateChange(Subscriber.java:340)
        at ie.macinnes.htsp.tasks.Authenticator.setState(Authenticator.java:113)
        at ie.macinnes.htsp.tasks.Authenticator.handleAuthenticateResponse(Authenticator.java:237)
        at ie.macinnes.htsp.tasks.Authenticator.onMessage(Authenticator.java:158)
        at ie.macinnes.htsp.HtspMessageDispatcher.onMessage(HtspMessageDispatcher.java:175)
        at ie.macinnes.htsp.HtspDataHandler.read(HtspDataHandler.java:115)
        at ie.macinnes.htsp.HtspConnection.processReadableSelectionKey(HtspConnection.java:302)
        at ie.macinnes.htsp.HtspConnection.run(HtspConnection.java:225)
        at java.lang.Thread.run(Thread.java:818)
kiall commented 7 years ago

This is caused by the HTSP library, https://github.com/kiall/android-htsp/blob/53112eef4b9468841b0b9a6b76f85fa5a20f2f6d/library/src/main/java/ie/macinnes/htsp/tasks/Subscriber.java#L147 will fail if a channel takes longer than 5 seconds to tune.

The subscriber needs to be reworked so that it's asynchronous, rather than synchronous as it is.

kiall commented 7 years ago

Moved over to android-htsp issue tracker https://github.com/kiall/android-htsp/issues/4