ccrtp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ccrtp-devel] 2 problem in rtp.h


From: Guillaume Glodas
Subject: [Ccrtp-devel] 2 problem in rtp.h
Date: Fri, 12 Mar 2004 13:20:23 +0100

Hi,

 
we've found a string initialisation problem in the source file
ccrtp-1.0.2/src/source.cpp

81,83c81,90
       if ( !strcmp(user,"") )
               user = Process::getEnv("USER");
       username = user;

when user is NULL, username which is a string, is wrongly initialised.

this piece of code seems to fix this bug :
       if (user) {
               if ( !strcmp(user,"") )
                       user = Process::getEnv("USER");
       if (user)
               username = user;
       else
               username="";
 }
 else
       username ="";
.

We've found a dead lock problem in the header file
ccrtp-1.0.2_local/src/ccrtp/rtp.h

    run()
        {
                microtimeout_t timeout = 0;
                while ( ServiceQueue::isActive() ) {
                        if ( !timeout ){
                                timeout = getSchedulingTimeout();
                        }
                        setCancel(cancelDeferred);
                        controlReceptionService();
                        controlTransmissionService();
                        setCancel(cancelImmediate);
                        microtimeout_t maxWait =
                               
timeval2microtimeout(getRTCPCheckInterval());
                        // make sure the scheduling timeout is
                        // <= the check interval for RTCP
                        // packets
                        timeout = (timeout > maxWait)? maxWait :
timeout;
                        if ( !timeout ) {
                                setCancel(cancelDeferred);
                                size_t r = dispatchDataPacket();
                                setCancel(cancelImmediate);
                                if ( r < 0 )
                                        timeout = timeout;
                                timerTick();
                        } else {
                                if ( isPendingData(timeout/1000) ) {
                                        setCancel(cancelDeferred);
                                        size_t r = takeInDataPacket();
                                        setCancel(cancelImmediate);
                                        if ( r < 0 )
                                                return;
                                }
                                timeout = 0;
                        }
                }
                dispatchBYE("GNU ccRTP stack finishing.");
                sleep(~0);
        }

if timeout < 100 timeout/1000 = 0
isPendingData(timeout/1000) == isPendingData(0)
if there no incoming data, isPendingData waits undefinitely.

This piece of code seems to solve the problem :
    run()
        {
                microtimeout_t timeout = 0;
                while ( ServiceQueue::isActive() ) {
                        if ( !(timeout/1000) ){
                                timeout = getSchedulingTimeout();
                        }
                        setCancel(cancelDeferred);
                        controlReceptionService();
                        controlTransmissionService();
                        setCancel(cancelImmediate);
                        microtimeout_t maxWait =
                               
timeval2microtimeout(getRTCPCheckInterval());
                        // make sure the scheduling timeout is
                        // <= the check interval for RTCP
                        // packets
                        timeout = (timeout > maxWait)? maxWait :
timeout;
                        if ( !(timeout/1000) ) {
                                setCancel(cancelDeferred);
                                size_t r = dispatchDataPacket();
                                setCancel(cancelImmediate);
                                if ( r < 0 )
                                        timeout = timeout;
                                timerTick();
                        } else {
                                if ( isPendingData(timeout/1000) ) {
                                        setCancel(cancelDeferred);
                                        size_t r = takeInDataPacket();
                                        setCancel(cancelImmediate);
                                        if ( r < 0 )
                                                return;
                                }
                                timeout = 0;
                        }
                }
                dispatchBYE("GNU ccRTP stack finishing.");
                sleep(~0);
        }

regards,

Guillaume Glodas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]