<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello Warren and thanks.<br>
<br>
<blockquote type="cite">
<pre style="white-space: pre-wrap; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">><i> On this line VS says: "HEAP: Free Heap block 3043560 modified at 304361c
</i>><i> after it was freed"
</i>
What does the stack trace look like when this happens?</pre>
</blockquote>
Here's the call stack:<br>
MFVideoGenerator Test.exe!_free_base(void * pBlock=0x039505f8)
Line 109 + 0x12 bytes C<br>
MFVideoGenerator Test.exe!_free_dbg_nolock(void *
pUserData=0x03950618, int nBlockUse=0x00000001) Line 1426 + 0x9
bytes C++<br>
MFVideoGenerator Test.exe!_free_dbg(void *
pUserData=0x03950618, int nBlockUse=0x00000001) Line 1258 + 0xd
bytes C++<br>
MFVideoGenerator Test.exe!operator delete(void * p=0x03950618)
Line 373 + 0xb bytes C++<br>
MFVideoGenerator Test.exe!BasicHashTable::`scalar deleting
destructor'() + 0x3c bytes C++<br>
MFVideoGenerator
Test.exe!RTCPMemberDatabase::~RTCPMemberDatabase() Line 35 + 0x37
bytes C++<br>
MFVideoGenerator Test.exe!RTCPMemberDatabase::`scalar deleting
destructor'() + 0x2b bytes C++<br>
MFVideoGenerator Test.exe!RTCPInstance::~RTCPInstance() Line
194 + 0x3a bytes C++<br>
MFVideoGenerator Test.exe!RTCPInstance::`scalar deleting
destructor'() + 0x2b bytes C++<br>
MFVideoGenerator Test.exe!MediaLookupTable::remove(const char *
name=0x0398bcb8) Line 151 + 0x35 bytes C++<br>
MFVideoGenerator Test.exe!Medium::close(UsageEnvironment &
env={...}, const char * name=0x0398bcb8) Line 54 C++<br>
MFVideoGenerator Test.exe!Medium::close(Medium *
medium=0x0398bcb0) Line 59 + 0x17 bytes C++<br>
MFVideoGenerator
Test.exe!CMulticastH264Streamer::StreamerThread() Line 232 + 0xc
bytes C++<br>
<br>
<br>
<blockquote type="cite">
<pre style="white-space: pre-wrap; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">It sounds like the opposite of a leak, where you're either
double-free'ing something or freeing something too early.</pre>
</blockquote>
I posted the code in the first post in this thread. Basically,
everything is in one thread (StreamerThread from the stack) and for
testing I disabled any methods that are called from other<br>
threads from outside (basically, threads that add H264/AAC data to
the sources). <br>
<br>
<blockquote type="cite">
<pre style="white-space: pre-wrap; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Can you run the app on Linux? If your app has a GUI, you should be able
to strip out the core of the app so that it will build and run on Linux
without the GUI. (If not, it means you have application logic mixed in
with your display code, which is bad design from the start.)</pre>
</blockquote>
I have couple of abstraction layers in separate libs until the code
is used by GUI (which is there (the GUI) for testing purposes only).
live555 is wrapped in separate lib, then one MediaFoundation
component that uses it, then<br>
MediaFoundation component(lib) that creates and run the stream flow
etc. Unfortunately, I cannot run the app on linux, because I do not
have any developer experience with it, nor can I run MediaFoundation
component for encoding H264/AAC in linux.<br>
<br>
<br>
Anyway, if you could look, here's my code from StreamerThread<br>
<br>
// Begin by setting up our usage environment:<br>
<br>
// Create 'groupsocks' for RTP and RTCP:<br>
<br>
// Create RTSP server<br>
<br>
// Create server media session<br>
<br>
// Video stream groupsock's<br>
<br>
RTCPInstance* rtcp = NULL;<br>
// Add H264 stream<br>
if( m_settings.VideoStream )<br>
{<br>
// Create a 'H264 Video RTP' sink from the RTP 'groupsock':<br>
<br>
// Create (and start) a 'RTCP instance' for this RTP sink:<br>
<br>
sms->addSubsession(
PassiveServerMediaSubsession::createNew( *m_pRtpVideoSink, rtcp ) );<br>
}<br>
<br>
// Audio stream groupsock's<br>
<br>
RTCPInstance* rtcpAudio = NULL;<br>
<br>
// Add AAC Stream<br>
if( m_settings.AudioStream )<br>
{<br>
// Create (and start) a 'RTCP instance' for this RTP sink:<br>
<br>
sms->addSubsession(
PassiveServerMediaSubsession::createNew( *m_pRtpAudioSink, rtcpAudio
) );<br>
}<br>
<br>
rtspServer->addServerMediaSession( sms );<br>
<br>
// Get the streaming URL<br>
m_streamingURL = rtspServer->rtspURL( sms );<br>
*m_pUsageEnv << "Play this stream using the URL \""
<< m_streamingURL << "\"\n";<br>
<br>
if( m_settings.VideoStream )<br>
{<br>
m_pH264FramedSource = CH264FramedSource::createNew(
*m_pUsageEnv, 0, 40000 );<br>
<br>
FramedSource* framedSource = m_pH264FramedSource;<br>
<br>
m_pH264DiscreteFramer =
H264VideoStreamDiscreteFramer::createNew( *m_pUsageEnv, framedSource
);<br>
<br>
m_pRtpVideoSink->startPlaying( *m_pH264DiscreteFramer,
afterPlayback, this );<br>
}<br>
<br>
if( m_settings.AudioStream )<br>
{<br>
timeval pTime;<br>
if( m_settings.VideoStream )<br>
{<br>
m_pH264FramedSource->GetPresentationTime(pTime);<br>
}<br>
m_pAacFrameedSource = AACFramedSource::createNew(
*m_pUsageEnv, 0, 40000, pTime );<br>
<br>
<br>
m_pRtpAudioSink->startPlaying( *m_pAacFrameedSource,
afterPlayback, this );<br>
}<br>
<br>
m_pUsageEnv->taskScheduler().doEventLoop( &m_doneFlag );
// does not return<br>
<br>
// Close everything<br>
//<br>
if(m_pRtpVideoSink != NULL)<br>
{<br>
m_pRtpVideoSink->stopPlaying(); <br>
}<br>
if(m_pRtpAudioSink != NULL)<br>
{<br>
m_pRtpAudioSink->stopPlaying();<br>
}<br>
<br>
Medium::close( m_pRtpVideoSink );<br>
Medium::close( m_pRtpAudioSink );<br>
<br>
Medium::close( m_pH264FramedSource );<br>
Medium::close( m_pAacFrameedSource );<br>
<br>
Medium::close(rtcp);<br>
Medium::close(rtcpAudio);<br>
<br>
rtpVideoGroupsock->removeAllDestinations();<br>
rtcpVideoGroupsock->removeAllDestinations();<br>
delete rtpVideoGroupsock;<br>
delete rtcpVideoGroupsock;<br>
<br>
rtpAudioGroupsock->removeAllDestinations();<br>
rtcpAudioGroupsock->removeAllDestinations();<br>
delete rtpAudioGroupsock;<br>
delete rtcpAudioGroupsock;<br>
<br>
Medium::close(rtspServer);<br>
<br>
m_pUsageEnv->reclaim();<br>
<br>
delete scheduler;<br>
<br>
SetEvent( m_hCloseEvt );<br>
<br>
Thanks.<br>
<br>
<br>
<br>
</body>
</html>