home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Quality Assurance
Bugreports
Archive
No connection could be made because the target machine actively refused it
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="mm1352000" data-source="post: 1136141" data-attributes="member: 82144"><p>If the problem is occurring in <em>FramedSource::getNextFrame() </em>where Sascha said, the error must be that <em>fIsCurrentlyAwaitingData</em> is <em>true</em> when it should be <em>false.</em></p><p></p><p>How did that variable get set <em>true</em>? Well, <em>fIsCurrentlyAwaitingData </em>is only set<em> true </em>in one place:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/FramedSource.cpp#L76" target="_blank"><em>https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/FramedSource.cpp#L76</em></a></p><p></p><p>Note that is at the end of the same <em>getNextFrame() </em>function.</p><p></p><p></p><p>How is this <em>getNextFrame() </em>function called?</p><p>It's a long story that starts when the streaming server is asked to start streaming a timeshift file:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/main.cpp#L214" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/main.cpp#L214</a></p><p></p><p><em>StreamAddTimeShiftFile()</em> creates a <em>TsMPEG2TransportFileServerMediaSubsession</em>, and adds it to the RTSP server.</p><p></p><p>We can see that the RTSP server is an instance of <em>MPRTSPServer</em>:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/main.cpp#L164" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/main.cpp#L164</a></p><p></p><p><em>MPRTSPServer</em> is an extension of <em>RTSPServer</em>:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/MediaPortal/MPRTSPServer.h#L30" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/MediaPortal/MPRTSPServer.h#L30</a></p><p></p><p>When a client tries to connect to an <em>RTSPServer</em> sub-session, it sends an RTSP SETUP command. That command is handled here:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/RTSPServer.cpp#L606" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/RTSPServer.cpp#L606</a></p><p></p><p>As part of <em>handleCmd_SETUP()</em> we see that the sub-session's <em>getStreamParameters() </em>function is called:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/RTSPServer.cpp#L726" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/RTSPServer.cpp#L726</a></p><p></p><p>Now, we have already seen that a timeshifting sub-session is an instance of <em>TsMPEG2TransportFileServerMediaSubsession. </em>A <em>TsMPEG2TransportFileServerMediaSubsession </em>is a <em>FileServerMediaSubsession</em>:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportFileServerMediaSubsession.h#L9" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportFileServerMediaSubsession.h#L9</a></p><p></p><p>...and a <em>FileServerMediaSubsession</em> is a <em>OnDemandServerMediaSubsession</em>:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/include/FileServerMediaSubsession.hh#L29" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/include/FileServerMediaSubsession.hh#L29</a></p><p></p><p>Therefore, when <em>getStreamParameters() </em>is called, the base implementation in <em>OnDemandServerMediaSubsession</em> will be called:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/OnDemandServerMediaSubsession.cpp#L144" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/OnDemandServerMediaSubsession.cpp#L144</a></p><p></p><p>Inside that function we see that <em>createNewStreamSource() </em>is called:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/OnDemandServerMediaSubsession.cpp#L172" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/OnDemandServerMediaSubsession.cpp#L172</a></p><p></p><p>This function is overridden by <em>TsMPEG2TransportFileServerMediaSubsession</em>:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportFileServerMediaSubsession.cpp#L36" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportFileServerMediaSubsession.cpp#L36</a></p><p></p><p>Within <em>createNewStreamSource() </em>we see that a new <em>TsStreamFileSource</em> is created, and wrapped in a <em>TsMPEG2TransportStreamFramer</em>:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportFileServerMediaSubsession.cpp#L42" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportFileServerMediaSubsession.cpp#L42</a></p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportFileServerMediaSubsession.cpp#L47" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportFileServerMediaSubsession.cpp#L47</a></p><p></p><p>When the server is streaming the timeshift file, <em>doGetNextFrame() </em>will be called repeatedly:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportStreamFramer.cpp#L78" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportStreamFramer.cpp#L78</a></p><p></p><p>We already know that <em>fInputSource</em> is a <em>TsStreamFileSource</em>; a <em>TsStreamFileSource</em> is a <em>FramedFileSource</em>:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsStreamFileSource.h#L33" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsStreamFileSource.h#L33</a></p><p></p><p>...and a <em>FramedFileSource </em>is a <em>FramedSource</em>:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/include/FramedFileSource.hh#L28" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/include/FramedFileSource.hh#L28</a></p><p></p><p>So, when <em>TsMPEG2TransportStreamFramer::doGetNextFrame() </em>calls <em>fInputSource->getNextFrame()</em>, it will call the base <em>FramedSource::getNextFrame()</em> function.</p><p></p><p>Now finally (!!!) we start to get closer to the explanation of the error! <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p></p><p></p><p><em>getNextFrame()</em> calls the virtual <em>doGetNextFrame() </em>function. In the case of timeshifting, this will call the implementation in <em>TsStreamFileSource</em>:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsStreamFileSource.cpp#L149" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsStreamFileSource.cpp#L149</a></p><p></p><p>At the end of <em>TsStreamFileSource::doGetNextFrame()</em>, we see that <em>FramedSource::afterGetting() </em>should be called:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsStreamFileSource.cpp#L202" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsStreamFileSource.cpp#L202</a></p><p></p><p><em>afterGetting() </em>is one of the three places where <em>fIsCurrentlyAwaitingData </em>is set <em>false</em>:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/FramedSource.cpp#L82" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/FramedSource.cpp#L82</a></p><p></p><p>In other words: it seems to me that the code is designed to set <em>fIsCurrentlyAwaitingData </em>to <em>true</em> in <em>getNextFrame()</em>, then set it back to <em>false </em>in <em>afterGetting(). </em>If the value is <em>true</em> already at the start of <em>getNextFrame()</em>, my guess is that <em>afterGetting()</em> has not been executed yet because of a delay in <em>doGetNextFrame().</em></p><p><em></em></p><p>Looking at the code in <em>doGetNextFrame()</em>, the most likely place for a delay seems to be when the code is trying to access the file system:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsStreamFileSource.cpp#L178" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsStreamFileSource.cpp#L178</a></p><p></p><p><em>GetFileSize() </em>is implemented here:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/MultiFileReader.cpp#L130" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/MultiFileReader.cpp#L130</a></p><p></p><p>As you can see, the implementation calls <em>RefreshTSBufferFile()</em>:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/MultiFileReader.cpp#L294" target="_blank">https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/MultiFileReader.cpp#L294</a></p><p></p><p>That function is relatively complex, and I suspect it could be slow in some rare cases. Especially:</p><p>1. When TsWriter is trying to update the buffer file.</p><p>2. When TV service is trying to clean up (delete) the buffer files.</p><p>3. If the timeshift folder is a shred folder.</p><p></p><p>[USER=128461]@Snoopy87[/USER] </p><p>In your plugin, what is the delay between stopping timeshifting... and starting timeshifting again?</p><p>If the delay is small, I wonder if TV service is still trying to delete the timeshift files... and that could be the reason for the problem.</p><p>I wonder what would happen if you try to increase (or reduce!) the delay.</p><p></p><p>[USER=83973]@Owlsroost[/USER]</p><p>Your thoughts about this would be most welcome.</p></blockquote><p></p>
[QUOTE="mm1352000, post: 1136141, member: 82144"] If the problem is occurring in [I]FramedSource::getNextFrame() [/I]where Sascha said, the error must be that [I]fIsCurrentlyAwaitingData[/I] is [I]true[/I] when it should be [I]false.[/I] How did that variable get set [I]true[/I]? Well, [I]fIsCurrentlyAwaitingData [/I]is only set[I] true [/I]in one place: [URL='https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/FramedSource.cpp#L76'][I]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/FramedSource.cpp#L76[/I][/URL] [I][/I] Note that is at the end of the same [I]getNextFrame() [/I]function. How is this [I]getNextFrame() [/I]function called? It's a long story that starts when the streaming server is asked to start streaming a timeshift file: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/main.cpp#L214[/URL] [I]StreamAddTimeShiftFile()[/I] creates a [I]TsMPEG2TransportFileServerMediaSubsession[/I], and adds it to the RTSP server. We can see that the RTSP server is an instance of [I]MPRTSPServer[/I]: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/main.cpp#L164[/URL] [I]MPRTSPServer[/I] is an extension of [I]RTSPServer[/I]: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/MediaPortal/MPRTSPServer.h#L30[/URL] When a client tries to connect to an [I]RTSPServer[/I] sub-session, it sends an RTSP SETUP command. That command is handled here: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/RTSPServer.cpp#L606[/URL] As part of [I]handleCmd_SETUP()[/I] we see that the sub-session's [I]getStreamParameters() [/I]function is called: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/RTSPServer.cpp#L726[/URL] Now, we have already seen that a timeshifting sub-session is an instance of [I]TsMPEG2TransportFileServerMediaSubsession. [/I]A [I]TsMPEG2TransportFileServerMediaSubsession [/I]is a [I]FileServerMediaSubsession[/I]: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportFileServerMediaSubsession.h#L9[/URL] ...and a [I]FileServerMediaSubsession[/I] is a [I]OnDemandServerMediaSubsession[/I]: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/include/FileServerMediaSubsession.hh#L29[/URL] Therefore, when [I]getStreamParameters() [/I]is called, the base implementation in [I]OnDemandServerMediaSubsession[/I] will be called: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/OnDemandServerMediaSubsession.cpp#L144[/URL] Inside that function we see that [I]createNewStreamSource() [/I]is called: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/OnDemandServerMediaSubsession.cpp#L172[/URL] This function is overridden by [I]TsMPEG2TransportFileServerMediaSubsession[/I]: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportFileServerMediaSubsession.cpp#L36[/URL] Within [I]createNewStreamSource() [/I]we see that a new [I]TsStreamFileSource[/I] is created, and wrapped in a [I]TsMPEG2TransportStreamFramer[/I]: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportFileServerMediaSubsession.cpp#L42[/URL] [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportFileServerMediaSubsession.cpp#L47[/URL] When the server is streaming the timeshift file, [I]doGetNextFrame() [/I]will be called repeatedly: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsMPEG2TransportStreamFramer.cpp#L78[/URL] We already know that [I]fInputSource[/I] is a [I]TsStreamFileSource[/I]; a [I]TsStreamFileSource[/I] is a [I]FramedFileSource[/I]: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsStreamFileSource.h#L33[/URL] ...and a [I]FramedFileSource [/I]is a [I]FramedSource[/I]: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/include/FramedFileSource.hh#L28[/URL] So, when [I]TsMPEG2TransportStreamFramer::doGetNextFrame() [/I]calls [I]fInputSource->getNextFrame()[/I], it will call the base [I]FramedSource::getNextFrame()[/I] function. Now finally (!!!) we start to get closer to the explanation of the error! :) [I]getNextFrame()[/I] calls the virtual [I]doGetNextFrame() [/I]function. In the case of timeshifting, this will call the implementation in [I]TsStreamFileSource[/I]: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsStreamFileSource.cpp#L149[/URL] At the end of [I]TsStreamFileSource::doGetNextFrame()[/I], we see that [I]FramedSource::afterGetting() [/I]should be called: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsStreamFileSource.cpp#L202[/URL] [I]afterGetting() [/I]is one of the three places where [I]fIsCurrentlyAwaitingData [/I]is set [I]false[/I]: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/LiveMedia555/liveMedia/FramedSource.cpp#L82[/URL] In other words: it seems to me that the code is designed to set [I]fIsCurrentlyAwaitingData [/I]to [I]true[/I] in [I]getNextFrame()[/I], then set it back to [I]false [/I]in [I]afterGetting(). [/I]If the value is [I]true[/I] already at the start of [I]getNextFrame()[/I], my guess is that [I]afterGetting()[/I] has not been executed yet because of a delay in [I]doGetNextFrame(). [/I] Looking at the code in [I]doGetNextFrame()[/I], the most likely place for a delay seems to be when the code is trying to access the file system: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/TsStreamFileSource.cpp#L178[/URL] [I]GetFileSize() [/I]is implemented here: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/MultiFileReader.cpp#L130[/URL] As you can see, the implementation calls [I]RefreshTSBufferFile()[/I]: [URL]https://github.com/MediaPortal/MediaPortal-1/blob/master/DirectShowFilters/StreamingServer/Source/MultiFileReader.cpp#L294[/URL] That function is relatively complex, and I suspect it could be slow in some rare cases. Especially: 1. When TsWriter is trying to update the buffer file. 2. When TV service is trying to clean up (delete) the buffer files. 3. If the timeshift folder is a shred folder. [USER=128461]@Snoopy87[/USER] In your plugin, what is the delay between stopping timeshifting... and starting timeshifting again? If the delay is small, I wonder if TV service is still trying to delete the timeshift files... and that could be the reason for the problem. I wonder what would happen if you try to increase (or reduce!) the delay. [USER=83973]@Owlsroost[/USER] Your thoughts about this would be most welcome. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Quality Assurance
Bugreports
Archive
No connection could be made because the target machine actively refused it
Contact us
RSS
Top
Bottom