-
-
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
[upnpcontrol] Support for more audio streams through the HTTP audio s… #15122
Conversation
…ervlet Related to openhab#15113 Signed-off-by: Laurent Garnier <[email protected]>
70d2f22
to
b1c33bb
Compare
} | ||
playMedia(url); | ||
try { | ||
audioStream.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dalgwen : please confirm that it is ok to close the audio stream at this place (async handling).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can, but I think it's better not to :
-
You can do this, because your AudioSink asks the servlet to make it a multi time stream.
And thus, all call to the servlet will clone the stream, and the original stream won't be needed. So it's OK if you close it. -
You don't have to, because the AudioServlet will close it (when removeTimedOutStreams or createClonableInputStream is called). And since the rewrite, removeTimedOutStreams is always called (before, it was not and it was a potential resource leak)
-
Please also note that for Audio Sink that do not require multi time stream, this is a faulty behaviour. A one time stream is directly used by the servlet to give audio data to the requesting device, and thus should not be closed.
So I suggest not closing it, to have a consistent code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, fine.
I will keep this only for the case URLAudioStream.
I did not test this, and I don’t have an answer to your question about the right place to close the stream. Apart from that LGTM. @dalgwen should comment. |
LGTM. |
...pcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/audiosink/UpnpAudioSink.java
Outdated
Show resolved
Hide resolved
Ok, this timeout is a low limit for volume restoration . But imagine that if the notification takes 30s for example, the volume restoration will occur after the end of the notification, not after 20s ? |
Signed-off-by: Laurent Garnier <[email protected]>
dad0f8f
to
d3c6380
Compare
Exactly. The audio sound will be available on the HTTP server for at least 20 seconds. And if a doGet() occurs during this 20 seconds, il will stay as long as it is needed to play it entirely, be it 30 seconds or one hour, by trying to guess the duration and making the assumption that the sound starts playing as soon as the doGet() occurs.
It should be binding dependant. I think Squeezebox binding is pretty slow to start for example. |
@openhab/add-ons-maintainers : I believe this PR is ready for a merge. |
openhab#15122) * [upnpcontrol] Support for more audio streams through the HTTP audio servlet Related to openhab#15113 Signed-off-by: Laurent Garnier <[email protected]>
openhab#15122) * [upnpcontrol] Support for more audio streams through the HTTP audio servlet Related to openhab#15113 Signed-off-by: Laurent Garnier <[email protected]> Signed-off-by: Matt Myers <[email protected]>
openhab#15122) * [upnpcontrol] Support for more audio streams through the HTTP audio servlet Related to openhab#15113 Signed-off-by: Laurent Garnier <[email protected]> Signed-off-by: Jørgen Austvik <[email protected]>
…ervlet
Related to #15113
Signed-off-by: Laurent Garnier [email protected]