Ejemplo n.º 1
0
void AudioManager::vpmsession_source_app(VPMSession &session,
                                     uint32_t ssrc,
                                     const char *app,
                                     const char *data,
                                     uint32_t data_len)
{
    std::string appS( app, 4 );
    std::string dataS( data, data_len );
    gravUtil::logVerbose( "AudioManager::RTCP_APP: ssrc: 0x%08x\n", ssrc );
    gravUtil::logVerbose( "AudioManager::RTCP_APP: %s,%s\n", appS.c_str(),
            dataS.c_str() );
    gravUtil::logVerbose( "AudioManager::RTCP_APP: data length is %i\n",
            data_len );

    if ( appS.compare( "site" ) == 0 )
    {
        for ( unsigned int i = 0; i < sources.size(); i++ )
        {
            if ( sources[i]->ssrc == ssrc )
            {
                sources[i]->siteID = dataS;
            }
        }
    }
}
Ejemplo n.º 2
0
void VideoListener::vpmsession_source_app( VPMSession &session,
        uint32_t ssrc, const char *app, const char *data, uint32_t data_len )
{
    std::string appS( app, 4 );
    std::string dataS( data, data_len );

    if ( appS.compare( "site" ) == 0 && objectMan->usingSiteIDGroups() )
    {
        objectMan->lockSources();

        // vic sends 4 nulls at the end of the rtcp_app string for some
        // reason, so chop those off
        dataS = std::string( dataS, 0, 32 );
        std::vector<VideoSource*>::iterator i =
                objectMan->getSources()->begin();

        // sometimes, if groups are enabled by default, we can get RTCP APP
        // before we get any sources added, resulting in a crash when we try
        // and dereference the sources pointer - so skip this if we don't have
        // any sources yet
        if ( objectMan->getSources()->size() == 0 )
        {
            objectMan->unlockSources();
            return;
        }

        while ( (*i)->getssrc() != ssrc )
        {
            ++i;
            if ( i == objectMan->getSources()->end() )
            {
                objectMan->unlockSources();
                return;
            }
        }

        if ( !(*i)->isGrouped() )
        {
            Group* g;
            std::map<std::string,Group*>::iterator mapi =
                    objectMan->getSiteIDGroups()->find( dataS );

            if ( mapi == objectMan->getSiteIDGroups()->end() )
                g = objectMan->createSiteIDGroup( dataS );
            else
                g = mapi->second;

            (*i)->setSiteID( dataS );
            g->add( *i );

            // adding & removing will replace the object under its group
            if ( objectMan->getTree() )
            {
                objectMan->getTree()->removeObject( (*i) );
                objectMan->getTree()->addObject( (*i) );

                objectMan->getTree()->updateObjectName( g );
            }
        }

        objectMan->unlockSources();
    }
}