-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Chromecast] fix audio sink (when requesting multiple times) #1799
Conversation
@lolodomo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @kaikreuzer, @tavalin and @BClark09 to be potential reviewers. |
What happens when the audio stream is longer than 30 seconds? |
Note that it concerns only audio files provided by openHAB and so notifications. The playback will very probably stop after the 30 seconds. This can be checked by downloading a big MP3 in conf/sounds and then play it. |
Tested and oh surprise, the playback is finally not stopped :) |
OK, if that is how it is supposed to work (30 seconds to receive any new requests) then in theory I am OK with the change. |
I updated my code (same code as the other PR for the Onkyo binding). @tavalin : note that for a radio stream, there will be no change (no duration limit), it will not be handled by the audio servlet, just a direct link. |
Yes I see that bit now. LGTM then. |
@tavalin : I tested the stream console command using different WEB radios as URL and it is working well. My PR is not impacting this part. |
It should not. Existing streams should not be killed by the servlet. If this is what this issue is about, we should indeed rather look at fixing the AudioServlet. |
It is not killed, confirmed by a test with a big MP3. In this case, the duration has apparently no impact which is finally a very good thing. I am just not sure that is what you expect ? |
Yes, this is what I expect - you can access the stream and you fully receive it.
So we would have to figure out why. Could you enable debug logging for the audio servlet:
We should then see what kind of requests the Android TV is doing. |
I will do and let you know the result. |
@kaikreuzer @tavalin : reading again the code from the audio servlet, I understood that the provided duration is only used to define a delay in which the file can be requested (with no restriction) to the servlet, and not a delay after which the servlet will break an already handled request. So it looks good and I understand now why I can cast a MP3 with a long duration without any interruption. |
That now understood, reducing the delay from 20s to 10s should probably be enough. |
I can now confirm that Android TV is requesting the audio file twice:
|
Trying a TTS command, I even noticed 3 requests:
|
After several tests, it seems to be generally 3 requests to the audio file. Even with my long duration MP3 audio file (several minutes), I only got 3 requests at the beginning of the playback All that seems to confirm that my PR is totally appropriate ;) |
Thanks, that is proof enough :-) |
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Done. |
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
…er (openhab#1799) This should fix the issue reported here: https://community.openhab.org/t/openhab-3-0-milestone-2-discussion/107564/8 where the Nashorn script engine would be created with the current thread's class loader, causing JS code like this: ``` var Log = Java.type("org.openhab.core.model.script.actions.Log"); Log.logError("Experiments", "This is an OH error log"); Log.logWarn("Experiments", "This is an OH warn log"); Log.logInfo("Experiments", "This is an OH info log"); Log.logDebug("Experiments", "This is an OH debug log"); ``` to run fine when the rule was triggered but fail to find the Log class when run from the REST API's `/rest/rules/{ruleUID}/runnow`, because in that case the generic createScriptEngine implementation would return script engines using the JAX-RS class loader as the "app" class loader. Note: We also have an opportunity to restrict which classes are exposed to the script with a ClassFilter to a specific set: https://docs.oracle.com/javase/8/docs/jdk/api/nashorn/jdk/nashorn/api/scripting/NashornScriptEngineFactory.html#getScriptEngine-java.lang.String:A-java.lang.ClassLoader-jdk.nashorn.api.scripting.ClassFilter- This could prove useful to mitigate code execution vulnerabilities, as the script code is modifiable remotely. Signed-off-by: Yannick Schaus <github@schaus.net>
Signed-off-by: Laurent Garnier lg.hc@free.fr