theniteow1 25 Posted December 16, 2015 Share Posted December 16, 2015 Hello guys! I have an issue that I've been trying to figure out. I noticed that ServerWMC will continue to stream channels even though no devices are currently watching the channel. I never understood what was causing it, but I think I've traced it to us power doing our FireTVs, without actually "stopping" the stream first. I've really noticed it now that I have all the TVs hooked up to "'Energy Saver" power strips that automatically shut off devices when the TV is powered off. It seems as thought ServerWMC doesn't know to stop streaming the channel once the device is not on anymore. Emby shows the device is no longer streaming the channel. Can you guys provide any insight on this? Logs are attached. Thanks! Link to comment Share on other sites More sharing options...
krustyreturns 191 Posted December 16, 2015 Share Posted December 16, 2015 Swmc relies on emby to tell it when the stream should stop, unless emby goes off-line for a few minutes - in that case swmc should kill any streams it has been receiving. I take it that both emby and swmc are staying on and its just your fire tv that is going off, right? In that case emby needs to send a CloseStream to swmc if/when it detects the ftv is off. We need @@Luke or someone to tell us if emby does this, because I don't know. I'm not really sure where to look in your log file, does it contain an instance of this happening? If you're not sure when it happens and you can trigger it again, do a restart of swmc then trigger the problem, then send me the log. 1 Link to comment Share on other sites More sharing options...
theniteow1 25 Posted December 17, 2015 Author Share Posted December 17, 2015 Swmc relies on emby to tell it when the stream should stop, unless emby goes off-line for a few minutes - in that case swmc should kill any streams it has been receiving. I take it that both emby and swmc are staying on and its just your fire tv that is going off, right? In that case emby needs to send a CloseStream to swmc if/when it detects the ftv is off. We need @@Luke or someone to tell us if emby does this, because I don't know. I'm not really sure where to look in your log file, does it contain an instance of this happening? If you're not sure when it happens and you can trigger it again, do a restart of swmc then trigger the problem, then send me the log. Understood! What's puzzling is Emby shows nothing streaming, but ServerWMC continues to stream. Yes, the logs should show an instance of this happening today. I can try directly to pin point the instance, and take a log file as soon it happens. Thanks for the help! Link to comment Share on other sites More sharing options...
theniteow1 25 Posted December 17, 2015 Author Share Posted December 17, 2015 Ok, I was able to duplicate it this morning. About 7:30 AM I tuned to Comedy Central, channel 53, and then just "shut off" the FireTV without closing out the stream. As you can see here 1 1/2 hours later it is still streaming the channel even though the FireTV is not directly tuned into it. I also did the same thing with the NFL Red Zone channel around 7:45 ish and just shutoff the FireTV without closing it out. I have attached the logs. Around 7:30-8:00 is the time you want to target. Thanks for your help! server-63585820800.zip Link to comment Share on other sites More sharing options...
ebr 14903 Posted December 17, 2015 Share Posted December 17, 2015 When you say "Shut off" you mean you basically pulled the plug on the device with your special power strip? For one thing, I would suggest not hooking the Fire up to this. The device goes into sleep mode after 30 minutes anyway. There is no need to have to go through the whole power-up and initialization process just to use it each time. However, if your people are not trained to stop the TV stream before turning off the TV then it is going to keep streaming to the device and leave it on indefinitely. Link to comment Share on other sites More sharing options...
theniteow1 25 Posted December 17, 2015 Author Share Posted December 17, 2015 When you say "Shut off" you mean you basically pulled the plug on the device with your special power strip? For one thing, I would suggest not hooking the Fire up to this. The device goes into sleep mode after 30 minutes anyway. There is no need to have to go through the whole power-up and initialization process just to use it each time. However, if your people are not trained to stop the TV stream before turning off the TV then it is going to keep streaming to the device and leave it on indefinitely. Sort of yes. I am doing this for one to save power. I know the FireTV will go in sleep mode, but sometimes it's dumb about it. For example I found my son had left his FireTV going for almost a week on YouTube streaming random videos. My wife will also just shuts off the TV, and lets the FireTV keep streaming the channel even though it's not being viewed. I recognize this is a training issue for sure, but it also seems logical that Emby/ServerWMC should recognize the device has been powered off and stop streaming. 1 Link to comment Share on other sites More sharing options...
ebr 14903 Posted December 17, 2015 Share Posted December 17, 2015 Yeah, if the power actually does cut then we should be able to discover it and adjust. And, doing what I suggest will actually exacerbate the issue in your particular situation. Its a tough issue to deal with because we are mostly conditioned through decades of TV use to just turn off the TV when we're done watching. But now, with all this streaming stuff, if you do that, the stream will just keep on going. As an app designer, the only thing we could do is put up some sort of annoying message every 30 or 60 minutes or something to ask "Are you still here?" Pandora, I think actually does that - or used to. But, I don't like that option too much because it would feel really stupid while watching a Football game or other long-running item. 1 Link to comment Share on other sites More sharing options...
krustyreturns 191 Posted December 17, 2015 Share Posted December 17, 2015 Serverwmc has no connection to the fire tv, it's only client is emby. However when a stream starts it does keep track of the amount of stream data that is being read and if there are no reads over a long interval it shuts the stream down. So you think that would solve it, but I looked at your log and these time-outs are not getting triggered. I assume that means emby's transcode is still pulling data from swmc even though your fire tv is off. If that's the case, it really needs to be emby that detects the down client and tells serverwmc to close the stream. So can emby detect the client is offline? Emby was designed to be very passive, so I am not sure it has this built into it. 1 Link to comment Share on other sites More sharing options...
theniteow1 25 Posted December 17, 2015 Author Share Posted December 17, 2015 Serverwmc has no connection to the fire tv, it's only client is emby. However when a stream starts it does keep track of the amount of stream data that is being read and if there are no reads over a long interval it shuts the stream down. So you think that would solve it, but I looked at your log and these time-outs are not getting triggered. I assume that means emby's transcode is still pulling data from swmc even though your fire tv is off. If that's the case, it really needs to be emby that detects the down client and tells serverwmc to close the stream. So can emby detect the client is offline? Emby was designed to be very passive, so I am not sure it has this built into it. Emby is not transcoding, it is direct streaming through HTTP to the FireTV. Does that matter in this scenario? Link to comment Share on other sites More sharing options...
krustyreturns 191 Posted December 17, 2015 Share Posted December 17, 2015 Emby is not transcoding, it is direct streaming through HTTP to the FireTV. Does that matter in this scenario? I don't know. @@ebr or @@Luke? Link to comment Share on other sites More sharing options...
ebr 14903 Posted December 18, 2015 Share Posted December 18, 2015 Emby is not transcoding, it is direct streaming through HTTP to the FireTV. Does that matter in this scenario? That probably means there is nothing we can do. At least not on the app or server end. Link to comment Share on other sites More sharing options...
krustyreturns 191 Posted December 18, 2015 Share Posted December 18, 2015 But in direct streaming mode, does it make sense that when the ftv is switched off emby would still be pulling stream data from serverwmc? Or in direct streaming mode, is the ftv reading stream data directly from serverwmc? Link to comment Share on other sites More sharing options...
ebr 14903 Posted December 18, 2015 Share Posted December 18, 2015 The FTV app is pulling it direct from the tuner (presumably) and he pulled the plug on the device so there is nothing the app can do and the server isn't even involved so there is nothing it can do. Link to comment Share on other sites More sharing options...
krustyreturns 191 Posted December 18, 2015 Share Posted December 18, 2015 Not in this case since they aren't dlna tuners, serverwmc is using windows drivers and storing tuner data and its then streaming this data to emby. Link to comment Share on other sites More sharing options...
ebr 14903 Posted December 18, 2015 Share Posted December 18, 2015 Okay, well he said it was direct-streaming. Link to comment Share on other sites More sharing options...
theniteow1 25 Posted December 18, 2015 Author Share Posted December 18, 2015 Came across something I'm quite not understanding to get around this issue with ServerWMC. I set a max viewing time of a Live TV stream for 3 hrs, however I set a time between 6:00pm - 10:00am, so it wouldn't shut off in the middle during these hours. However, it closed the stream last night around 1:36 am, am I not understanding the schedule correctly? Here is a snippet from the logs: 2015/12/18 01:36:06.089 MaintenanceTimer> Callback started... 2015/12/18 01:36:06.089 StopRemuxPastMaxRunLenth> PrimeTime: Enabled: True: Start: 6:00 PM, End: 10:00 AM, Current: 1:36 AM, IsPrimeTimeNow: False 2015/12/18 01:36:06.090 StopRemuxPastMaxRunLenth> Calling remux stop on stream 'Live-Remux space: ATSC num: 9.1', MaxTime: 3 hrs, RunTime: 3.002 hrs 2015/12/18 01:36:06.091 Remux::Stop> stop remux requested 2015/12/18 01:36:06.092 WtvToPesDemuxer::Parse> Guid header detects stream end 2015/12/18 01:36:06.102 Pass Type: 'Remux': 2015/12/18 01:36:06.102 > WtvToPesDemuxer::Parse> total guid headers processed: 5,448,613 2015/12/18 01:36:06.102 > WtvToPesDemuxer::Parse> total data packets processed: 823,508 2015/12/18 01:36:06.916 Remux> ENDED, >>>>>>>>>> Run Time: 180.11 min <<<<<<<<<< 2015/12/18 01:36:06.937 PurgeInactiveClients> error: closing stream[KUSAHD-9.1:34998], client is not reading. 2015/12/18 01:36:06.937 LiveRemuxStream::Close> remux thread had already stopped 2015/12/18 01:36:06.988 DeleteTS> ts file size: 18,153,209,856 2015/12/18 01:36:07.288 LiveRemuxStream::Close> could NOT delete ts file: D:\Recorded TV\TempSWMC\LiveTV_Emby^MCSERVER^9_ATSC_9.1_2015_12_17_22_35_57.ts 2015/12/18 01:36:07.288 RecordToWTV::Close> isPassive is False => COM recorder will be stopped 2015/12/18 01:36:07.386 LiveRemuxStream::Close> wtv closed successfully 2015/12/18 01:36:07.436 LiveRemuxStream::Close> wtv file size: 17,995,661,312 (0x430A00000) 2015/12/18 01:36:07.520 LiveRemuxStream::Close> wtv file deleted: D:\Recorded TV\TempSWMC\LiveTV_Emby^MCSERVER^9_ATSC_9.1_2015_12_17_22_35_57.wtv 2015/12/18 01:36:07.520 LiveRemuxStream::Close> closed in 0.58 sec Link to comment Share on other sites More sharing options...
krustyreturns 191 Posted December 18, 2015 Share Posted December 18, 2015 Its been a while since I looked at the code, but when you set the 'prime' viewing hours during 6-10 it will never auto shut off the stream during those hours. According to the log you posted it closed the stream after it ran for 3 hours. Since it closed it at 1:36AM, it thinks you start the stream at 10:36PM. Is that not right? Link to comment Share on other sites More sharing options...
theniteow1 25 Posted December 18, 2015 Author Share Posted December 18, 2015 Its been a while since I looked at the code, but when you set the 'prime' viewing hours during 6-10 it will never auto shut off the stream during those hours. According to the log you posted it closed the stream after it ran for 3 hours. Since it closed it at 1:36AM, it thinks you start the stream at 10:36PM. Is that not right? That is correct. Feel asleep to it, and then woke up realizing the TV had shut off. So am I to understand the schedule is a "24-hour" window? I would to have to set for example 12-am - 10am in order for it to function during the night, and It can't overlap days? Link to comment Share on other sites More sharing options...
krustyreturns 191 Posted December 18, 2015 Share Posted December 18, 2015 Not sure I understand what you are asking. You can set the prime viewing time to anything, even times after midnight (like 5PM to 1AM). During this viewing window the stream will never auto-close no matter how long it has been running for. Outside of that viewing window, if a stream has run longer then the max time you set, then it will be auto-closed. The idea is that while you are likely to be watching tv the stream never auto closes. Outside of that time, if the stream has run longer than 3 hours (or whatever you set) then likely someone has fallen asleep, and it auto-closes the stream. Link to comment Share on other sites More sharing options...
theniteow1 25 Posted December 18, 2015 Author Share Posted December 18, 2015 Not sure I understand what you are asking. You can set the prime viewing time to anything, even times after midnight (like 5PM to 1AM). During this viewing window the stream will never auto-close no matter how long it has been running for. Outside of that viewing window, if a stream has run longer then the max time you set, then it will be auto-closed. The idea is that while you are likely to be watching tv the stream never auto closes. Outside of that time, if the stream has run longer than 3 hours (or whatever you set) then likely someone has fallen asleep, and it auto-closes the stream. Ok, then that's why I'm confused, I set the time to 6:00 PM - 10:00 AM. I started the channel at 10:36 PM, it ran for 3 hours, and stopped itself at 1:36 AM. This shouldn't have happened correct, or am I missing something? Link to comment Share on other sites More sharing options...
krustyreturns 191 Posted December 19, 2015 Share Posted December 19, 2015 Ah, I get it now. Sounds like a bug then, let me do some checking and I'll get back to you. 1 Link to comment Share on other sites More sharing options...
theniteow1 25 Posted December 19, 2015 Author Share Posted December 19, 2015 Ah, I get it now. Sounds like a bug then, let me do some checking and I'll get back to you. Thanks for your help! Link to comment Share on other sites More sharing options...
krustyreturns 191 Posted December 19, 2015 Share Posted December 19, 2015 Yep, my fault, sorry about that. I have it fixed, if you want to test it let me know and I'll get you an installer. Otherwise the fix will be in the next release. One more problem though: This workaround you came up with will free your tuner, however if you look carefully at the log you posted - after the stream is auto-closed -serverwmc tries to delete the temporary TS file that is has been building and streaming to emby. But this deletion fails, because as you noted already, emby still thinks it is streaming to the ftv so emby is holding this file open. So Swmc won't be able to delete it until emby closes it. If you have plenty of disk space, probably won't be a problem, I'm sure emby must close it eventually and then swmc will delete it as part of its maintenance check. 2 Link to comment Share on other sites More sharing options...
theniteow1 25 Posted December 21, 2015 Author Share Posted December 21, 2015 Yep, my fault, sorry about that. I have it fixed, if you want to test it let me know and I'll get you an installer. Otherwise the fix will be in the next release. One more problem though: This workaround you came up with will free your tuner, however if you look carefully at the log you posted - after the stream is auto-closed -serverwmc tries to delete the temporary TS file that is has been building and streaming to emby. But this deletion fails, because as you noted already, emby still thinks it is streaming to the ftv so emby is holding this file open. So Swmc won't be able to delete it until emby closes it. If you have plenty of disk space, probably won't be a problem, I'm sure emby must close it eventually and then swmc will delete it as part of its maintenance check. Excellent, thank you for all the effort you put in. I would be happy to test it. I understand about the stream continuing endlessly. In the end, I would also love to see a way to get Emby to recognize the stream should be stopped if the device is powered off. Let me know if there is anything else you guys need from me. Link to comment Share on other sites More sharing options...
Solution krustyreturns 191 Posted December 28, 2015 Solution Share Posted December 28, 2015 Fyi, the fix for this is in build 1225. @@theniteow1, sorry I forgot to send you the test install, also that I forgot to list this as one of the changes in the changelog (its in there now), 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now