2010-03-26, 13:49
Hello everyone,
while implementing a UPnP streaming server in one of our DVB devices, i discovered an issue with WSAStartup/WSACleanup calls on windows.
First, i made the following change to be able to playback the transportstream. Without that change the auto detection sometimes believes that the stream is an MP3 stream.
Anyway, the following happens: When XBMC is started, WSAStartup is called twice. The first time it is called by NPT_WinsockSystem::NPT_WinsockSystem() the second time by libcurl.
So far so good. When i try to play a transportstream, CDVDDemuxFFmpeg is created and the stream is played. As soon as i stop the stream the following happens:
That WSACleanup call is wrong here, because no WSAStartup has been done by avformat-52.dll. The result of this error is that i can only playback two streams. Any upcoming socket function call in XBMC fails with WSAGetLastError() == WSANOTINITIALISED. I added a workaround by replacing
withThis works perfectly fine but seems wrong because the bug is actually in avformat and i don't really know if these FFMPEG libraries are custom build for XBMC.
Any suggestions on that one?
while implementing a UPnP streaming server in one of our DVB devices, i discovered an issue with WSAStartup/WSACleanup calls on windows.
First, i made the following change to be able to playback the transportstream. Without that change the auto detection sometimes believes that the stream is an MP3 stream.
Code:
bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput)
...
else if( content.compare("video/x-mpeg2-ts") == 0 )
iformat = m_dllAvFormat.av_find_input_format("mpegts");
Anyway, the following happens: When XBMC is started, WSAStartup is called twice. The first time it is called by NPT_WinsockSystem::NPT_WinsockSystem() the second time by libcurl.
So far so good. When i try to play a transportstream, CDVDDemuxFFmpeg is created and the stream is played. As soon as i stop the stream the following happens:
Code:
CDVDDemuxFFmpeg::Dispose() is called
m_dllAvFormat.url_fclose(m_ioContext); is executed
avformat-52.dll calls WSACleanup
Code:
CDVDDemuxFFmpeg::Dispose()
...
m_dllAvFormat.av_close_input_stream(m_pFormatContext);
m_dllAvFormat.url_fclose(m_ioContext);
Code:
CDVDDemuxFFmpeg::Dispose()
...
m_dllAvFormat.av_close_input_stream(m_pFormatContext);
#ifdef _WIN32
WSADATA wsaData;
WSAStartup(MAKEWORD(2,2), &wsaData);
#endif
m_dllAvFormat.url_fclose(m_ioContext);
Any suggestions on that one?