[Live-devel] Streamer eats up Cpu

David Wu davidw at aten-ca.com
Tue Mar 15 16:25:11 PST 2005


Dear Ross,

My streamer uses a audio recorder, not a file source. So finally, I combined what you said, and what I found in WindowsAudioInputDevice_common.cpp. The following is my current codes. Please take a look and tell me if it is right. 

    // If there is no compressed sound data
    if (UnitNum==0){
        nextTask() = envir().taskScheduler().scheduleDelayedTask(
            PktGapUSec,(TaskFunc*)FramedSource::afterGetting, this);
        return; // now PktGapUSec=20 
    };
    //Otherwise, there is compressed sound data

    // Set the 'presentation time' and 'duration' of this frame:
    if (fPresentationTime.tv_sec == 0 && fPresentationTime.tv_usec == 0) {
    // This is the first frame, so use the current time:
        int Idunno;
        gettimeofday(&fPresentationTime, &Idunno);
    } else {
    // Increment by the play time of the previous data:
        unsigned uSeconds = fPresentationTime.tv_usec + PktPlayUSec;
        fPresentationTime.tv_sec += uSeconds/1000000;
        fPresentationTime.tv_usec = uSeconds%1000000;
    }

    // Remember the play time of this data:
    PktPlayUSec=UnitUSec*UnitNum;
    fDurationInMicroseconds=PktPlayUSec;

    afterGetting(this); // No delay at all


Thanks for your time and help.

David Wu



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live.com/pipermail/live-devel/attachments/20050315/2bdafb06/attachment.html


More information about the live-devel mailing list