RE: how Helix deal with the scenarion that ausbdisk is pluged out during playback?
"Zhao, Halley" <[email protected]>
| Newsgroups | gmane.comp.multimedia.helix.devel |
|---|---|
| Message-ID | <094BCE01AFBE9646AF220B0B3F367AAB034999CF@pdsmsx413.ccr.corp.intel.com> |
I haven't fixed the issue, but got some clue: 1. memory map is used for file-io, see common/fileio/mmapmgr.cpp. In GetBlock(), the pBuffer is calculated from the page information, it may be invalid, then when there is a memcpy(), it will crash the engine. On Windows system, it used ::IsBadReadPtr()to catch the exception as early as possible. But there is no such check (error handle) for Linux platform. 2. I tried to find some code works like IsBadReadPtr(), and wrap that in mmapmgr.cpp. see attachment. That works some to me, but need more debug. 3. after some try above, I found some other issue in smplfsys.cpp In function CheckForCorruptFile(), I found it fail to determine it is a corrupt file because m_ulSize equals to 0. it is unexpected. BR >-----Original Message----- >From: [email protected] >[mailto:[email protected]] On Behalf Of Zhao, >Halley >Sent: 2008年7月16日 8:40 >To: [email protected]; [email protected] >Subject: RE: [Helix-client-dev] how Helix deal with the scenarion that >ausbdisk is pluged out during playback? > > I met the same symptom as you. > Smplfsys think it has got enough data without error. > > Where is the IHXDataFile for Linux system? Is it >common/fileio/bufdataf.cpp? > > > >-----Original Message----- > >From: Eric Hyche [mailto:[email protected]] > >Sent: 2008年7月15日 22:32 > >To: Zhao, Halley; [email protected] > >Subject: RE: [Helix-client-dev] how Helix deal with the scenarion that >a > >usbdisk is pluged out during playback? > > > > > >Halley, > > > >Extensive work was done in filesystem/local/full/smplfsys.cpp > >to handle cases when the underlying IHXDataFile object > >returns 0 bytes of returns less than requested (or returns > >an error). > > > >However, in your case, it looks like the IHXDataFile > >is saying it returned enough data, so the code to > >handle these cases in smplfsys.cpp is not being > >triggered. > > > >When the USB disk is unplugged, what is the behavior > >of the IHXDataFile? Does it return 0 bytes when a > >::Read() is requested? Does it return an error via > >IHXDataFile::GetLastError()? > > > >Eric > > > >============================================= > >Eric Hyche ([email protected]) > >Technical Lead > >RealNetworks, Inc. > > > >> -----Original Message----- > >> From: [email protected] > >> [mailto:[email protected]] On > >> Behalf Of Zhao, Halley > >> Sent: Monday, July 14, 2008 5:45 AM > >> To: [email protected] > >> Subject: [Helix-client-dev] how Helix deal with the scenarion > >> that a usbdisk is pluged out during playback? > >> > >> When Helix player is playing content on USB disk, then user > >> unplug the USB disk, helix engine will crash in such scenario. > >> > >> I test it for helix-player and player_gtk_test on Linux, > >> helix engine will crash in such scenario. > >> > >> On Windows system, Realplayer works well in such scenario, > >> the presentation stopped, but you could open another stream. > >> > >> > >> > >> When I looked into some source code at > >> filesystem/local/full/smplfsys.cpp, > >> > >> I found there seems to be some function to deal with such > >> scenario: CheckForCorruptFile(). > >> > >> However, when I try to debug it, I found the function isn't > >> invoked in the scenario above. > >> > >> > >> > >> And I found after the last call to FinishDoRead(), the engine crash. > >> > >> But in this last call, for the condition sentence to > >> CheckForCorruptFile(): > >> > >> if (!pBuffer || actual < m_ulPendingReadCount) > >> > >> > >> > >> the pBuffer is valid and actual = 2048, and > >> m_ulPendingReadCount = 2048. > >> > >> > >> > >> I think the scenario should be a common error handle for > >> source plugin, > >> > >> Did anybody meet such issue before? Or maybe someone fix it > >> in other branch? > >> > >> > >> > >> BR > >> > >> > >> > >> > >> > >> > >> > >> ZHAO, Halley (Aihua) > >> > >> Email: [email protected] <mailto:[email protected]> > >> > >> Tel: +86(21)61166476 > >> > >> iNet: 8821-6476 > >> > >> SSG/OTC/UMD > >> > >> > >> > >> > > >_______________________________________________ >Helix-client-dev mailing list >[email protected] >http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev _______________________________________________ Helix-client-dev mailing list [email protected] http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev
_IsBadReadPtr-linux.txt
(text/plain, 640 B)
#include <setjmp.h>
#include <signal.h>
// globals
unsigned char g_ucCalledByTestRoutine = 0;
jmp_buf g_pBuf;
void __cdecl MemTestHandler ( int nSig)
{
if ( g_ucCalledByTestRoutine ) longjmp ( g_pBuf, 1);
}
bool _IsBadReadPtr(const void* pv, unsigned long ulSize)
{
char* pc;
void(*pPrev) ( int sig);
g_ucCalledByTestRoutine = 1;
if(setjmp ( g_pBuf))
{
return true;
}
pPrev = signal (SIGSEGV, MemTestHandler);
pc = (char*) malloc ( ulSize);
memcpy ( pc, pv, ulSize);
free(pc);
g_ucCalledByTestRoutine = 0;
signal ( SIGSEGV, pPrev);
return false;
}
common-fileio-mmapmgr.cpp
(application/octet-stream, 32.4 KB) - not displayed