logo       

Re: opal & msvc6 - bug? found: msg#00430

telephony.openh323.general

Subject: Re: opal & msvc6 - bug? found

here are the mods that i made to build opal sample apps (ex CVS) under vc6 :

(note : quoted line numbers may not be exact - i may not have removed all my memory checks)

** Apparent BUG in video (?)

Using my camera in windows, Opal originally constructs an OpalMediaVideoStream with a buffer large enough for frame + header;
see mediastrm.cxx line 705 :

SetDataSize(sizeof(OpalVideoTranscoder::FrameHeader)+in->GetMaxFrameBytes());


later in the process, it resets the size in OpalMediaPatch::AddSink,
patch.cxx line 241.

source.SetDataSize(sink->primaryCodec->GetOptimalDataFrameSize(TRUE));

this allocation does not allow for the FrameHeader, causing a buffer overrun. it is missed by the check in OpalVideoMediaStream::ReadData mediastrm.cxx line 756,

if (size < defaultDataSize) {
since defaultDataSize is wrong at this point.

my (provisional) fix is as follows :

1/ added virtual SetDataSize() to OpalVideoMediaStream (mediastrm.h line 662)

virtual BOOL SetDataSize(
PINDEX dataSize /// New data size
);

2/ changed the OpalVideoMediaStream constructor to call SetDataSize() not including hdr :
mediastrm.cxx line 705 :

//SetDataSize(sizeof(OpalVideoTranscoder::FrameHeader)+in->GetMaxFrameBytes());
SetDataSize(in->GetMaxFrameBytes());


3/ added the virtual SetDataSize() to mediastrm.cxx (line 709)

BOOL OpalVideoMediaStream::SetDataSize(PINDEX dataSize)
{
return OpalMediaStream::SetDataSize(sizeof(OpalVideoTranscoder::FrameHeader)+dataSize);
}

these may not be optimal fixes;
i'm still testing (vc claims a memory leak on program exit), but it seems to solve the heap assertion i was getting.

** changes for c streams compatibility

1/ mediafmt.cxx line 333 (CVS):
//strm.setstate(ios::badbit)
#if __USE_STL__
strm.setstate(ios::badbit);
#else
strm.setf(ios::badbit , ios::badbit);
#endif

2/ mediaformat.h line 340 (before OpalMediaOptionValue template):
#if ! __USE_STL__
__inline istream & operator>>(istream & strm, bool& b)
{
int i;strm >> i;b = i; return strm;
}
#endif


Adrian
------------------------------------------------------------------------
Check the FAQ before asking! - http://www.openh323.org/~openh323/fom.cgi
The OpenH323 Project mailing list, using Mailman. To unsubscribe or
change your subscription options, goto
http://www.openh323.org/mailman/listinfo/openh323
Maintained by Quicknet Technologies, Inc - http://www.quicknet.net
------------------------------------------------------------------------



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise