> Here is doGetNextFrame on my video source (cout statements are there for 
> debugging this issue): 
> 
> void SimpleFramedSource::doGetNextFrame()
> {
>     std::cout << "-"; 
>     long currentTickCount = ::GetTickCount();
> 
>     _lastTickCount = currentTickCount;
> 
>     if (this->_nalQueue.empty())
>     {
>         // get a frame of data, encode, and enqueue it. 
>         this->GetFrameAndEncodeToNALUnitsAndEnqueue();

This is a problem.  If there are no NAL units currently available, then your 
code is calling something that (presumably) blocks until it gets a new NAL 
unit.  During this time, the LIVE555 event loop won’t get to run (and, in 
particular, won’t get to process audio).  That probably explains your problem.

It’s important to appreciate that because LIVE555-based applications are 
event-driven, all I/O should be asynchronous.  You shouldn’t have anything 
(running within the LIVE555 event loop) that ‘blocks’, waiting for data to 
arrive.  Instead, the arrival of new data needs to be treated as an 
(asynchronous) event.

One way to do this is to have a separate thread handling your H.264 video 
encoder, and have this ‘video encoder thread’ signal the LVIE555 event loop 
thread using the “triggerEvent()” function - which is the *only* LIVE555 
function that you may call from outside the LIVE555 event loop thread.  For an 
illustration of how to do this, see the pseudo code in 
“liveMedia/DeviceSource.cpp”.


> By the way, off topic (and I don't know if you care to know), but I had to 
> fix something in your waveInCallback method (in 
> WindowsAudioInputDevice_common). The callback method needs to have DWORD 
> parameters changed to DWORD_PTR to support 64-bit Windows. 
> 
> static void CALLBACK waveInCallback(HWAVEIN /*hwi*/, UINT uMsg,
>     DWORD_PTR /*dwInstance*/, DWORD_PTR dwParam1, DWORD_PTR /*dwParam2*/) {

Thanks.  Was this the *only* change that you had to make here - i.e., change 
the three occurrences of “DWORD” to “DWORD_PTR” in the callback function 
signature?  If so, then I’ll make this change in the next release of the 
software.


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to