[Live-devel] Question about DeviceSource

Dixon Siu dixonsiu at mediaglue.co.jp
Mon May 24 16:48:31 PDT 2004


Hi,

I wrote my DeviceSource to read from a global buffer instead of reading from
a file. Theoretically, the fReadBuffer gets updated everything when I read
it from doGetNextFrame. I had a printf statement to make sure fTo is
pointing to the the same char array as the fReadBuffer. The following is my
code. Very simple.

void DeviceSource::doGetNextFrame() {
	//int remainSize = fPreferredFrameSize;
	// Waiting for the device to allow us to read the buffer.
	WaitForSingleObject(mgcReadBufferEvent, INFINITE);
	//fMaxSize = fPreferredFrameSize;
	fTo = (unsigned char*) fReadBuffer;
	printf("fTo value is %c\n", fTo[0]);
	fFrameSize = fPreferredFrameSize;

    // We don't know a specific play time duration for this data,
    // so just record the current time as being the 'presentation time':
    gettimeofday(&fPresentationTime, &Idunno);
	nextTask()
    = envir().taskScheduler().scheduleDelayedTask(0,
(TaskFunc*)afterGetting,
						  this);
}

However, somewhere along the line, the fTo pointer nolonger pointing to the
correct array. When the content is sent to SimpleRTPSink, the receiver end
only receives "0". I was wondering where is the other place in the library
that fTo is accessed and changed. Does anyone have the same problem and know
the answer? Any suggestion is good. Thanks.

Regards,
Dixon Siu
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.688 / Virus Database: 449 - Release Date: 2004/05/18



More information about the live-devel mailing list