예제 #1
0
QVariant FeedItem::data(int role) const
{
    switch(role) {
    case UidRole:
        return uid();
    case TitleRole:
        return title();
    case ContentRole:
        return content();
    case LinkRole:
        return link();
    case UrlRole:
        return url();
    case IconRole:
        return icon();
    case StreamIdRole:
        return streamId();
    case UnreadRole:
        return unread();
    case ReadRole:
        return read();
    case ReadlaterRole:
        return readlater();
    case FreshRole:
        return fresh();
    default:
        return QVariant();
    }
}
예제 #2
0
// ---------------------------------------------------------------------------
// CStunTurnTests::TestCreateWrapperL
// ---------------------------------------------------------------------------
//
void CStunTurnTests::TestCreateWrapperL()
    {
    TUint sessionId( 0 );
    TUint streamId( 0 );
    
    MNATFWSocketMediaConnWrapper* wrapperIF;
    
    RDebug::Print( _L( "TEST PRINT: Create session and stream" ) ); 
    sessionId = iNat.CreateSessionL( iTestIapId, iTestDomain->Des() );
   
    iIfStub.StartActiveSchedulerL();
    
    streamId = iNat.CreateStreamL( sessionId, iProtocol, KDefaultQos );
    
    RDebug::Print( _L( "\nTEST CASE: Create wrapper" ) );
    wrapperIF = &iNat.CreateWrapperL( sessionId, streamId );
    
    if ( wrapperIF->StreamId() != streamId )
        {
        RDebug::Print( _L( "TEST PRINT: CStunTurnTests::TestCreateWrapperL, streamId is not equal" ) );
        User::Leave( KErrCompletion );
        }
    RDebug::Print( _L( "TEST PRINT: Close stream and session" ) );    
    iNat.CloseStreamL( sessionId, streamId );
    iNat.CloseSessionL( sessionId );
    }
예제 #3
0
void PluginTransfer::onStreamsRequestFinished() {
    if (m_streamsRequest->status() == ResourcesRequest::Ready) {
        QVariantList list = m_streamsRequest->result().toMap().value("items").toList();
        
        foreach (QVariant v, list) {
            QVariantMap stream = v.toMap();
        
            if (stream.value("id") == streamId()) {
                startDownload(stream.value("url").toString());
                return;
            }
        }
예제 #4
0
// ---------------------------------------------------------------------------
// CTestDtmf::TestStreamCreationL
// ---------------------------------------------------------------------------
//
void CTestDtmf::TestStreamCreationL( TDtmfSignalType aSigType )
    {
    TMccNetSettings tempSettings = iNetsettings;
    
    CMccInterfaceStub* stub = CMccInterfaceStub::NewL();
    CleanupStack::PushL( stub );
    CMccInterface* interface = CMccInterface::NewL( *stub );
    CleanupStack::PushL( interface );
    
    TUint32 sessionId;
    User::LeaveIfError( interface->CreateSession( sessionId ) );
    
    TUint32 linkId;
    TInt linkType( KMccLinkGeneral );
    User::LeaveIfError( interface->CreateLink( sessionId, linkType, linkId,
        tempSettings ) );
    stub->WaitForEvent( sessionId, linkId, 0, KMccLinkCreated );
    
    CMccCodecInformation* cInfo 
        = FetchCodecByMimeSubtypeNameL( *interface, KTxtDtmf );
    CleanupStack::PushL( cInfo );
    
    if ( aSigType == EInbandSignal )
        {
        cInfo->SetCodecMode( EDTMFModeInband );
        }
    else
        {
        cInfo->SetCodecMode( EDTMFModeEvent );
        }
        
    TUint32 streamId( 0 );
    TUint32 endpointId1( 0 ), endpointId2( 0 );
    User::LeaveIfError(
        interface->AddDataSink( KMccRtpSinkUid, KNullDesC8, endpointId1 ) );
    User::LeaveIfError(
        interface->AddDataSource( KMccRtpSourceUid, KNullDesC8, endpointId2 ) );
    
    User::LeaveIfError( interface->CreateStream( sessionId, linkId, streamId,
        KMccDtmfStream, *cInfo ) );
    
    User::LeaveIfError( interface->DeleteStream( sessionId, linkId, streamId ) );
    //interface->RemoveDataSink( endpointId1 );
    //interface->RemoveDataSource( endpointId1 );
    User::LeaveIfError( interface->CloseLink( sessionId, linkId ) );
    User::LeaveIfError( interface->CloseSession( sessionId ) );
    
    CleanupStack::PopAndDestroy( cInfo );
    CleanupStack::PopAndDestroy( interface );
    CleanupStack::PopAndDestroy( stub );    
    }
예제 #5
0
// ---------------------------------------------------------------------------
// CNcmSession::CreateStreamL
// ---------------------------------------------------------------------------
//
TUint CNcmSession::CreateStreamL( TInt aQos,
    TUint aProtocol )
    {
    TUint streamId( GenerateStreamId() );

    CNcmStream* item = CNcmStream::NewL(
        iSessionId, streamId, aQos, aProtocol );
        
    CleanupStack::PushL( item );
    iStreams.AppendL( item ); 
    CleanupStack::Pop( item );
    
    return item->StreamId();
    }
예제 #6
0
void PluginTransfer::onStreamsRequestFinished() {
    if (m_streamsRequest->status() == ResourcesRequest::Ready) {
        const QVariantMap result = m_streamsRequest->result().toMap();
        
        if (result.contains("items")) {
            const QVariantList list = result.value("items").toList();
            
            foreach (const QVariant &v, list) {
                const QVariantMap stream = v.toMap();
                
                if (stream.value("id") == streamId()) {
                    const QFileInfo info(downloadPath() + fileName());
                    QString suffix = info.suffix();
                    
                    if (suffix.isEmpty()) {
                        suffix = stream.value("ext").toString();
                        
                        if (!suffix.isEmpty()) {
                            if (!suffix.startsWith(".")) {
                                suffix.prepend(".");
                            }
                            
                            setFileName(info.completeBaseName() + suffix);
                        }
                    }
                    
                    startDownload(stream.value("url").toString());
                    return;
                }
            }
        }
        else if (result.contains("service")) {
            const QString service = result.value("service").toString();
            
            if (service == Resources::SOUNDCLOUD) {
                soundcloudStreamsRequest()->get(result.value("id").toString());
            }
            else {
                setErrorString(tr("Attempted redirect to unsupported service '%1'").arg(service));
                Logger::log("PluginTransfer::onStreamsRequestFinished(). Error: " + errorString());
                setStatus(Failed);
            }
            
            return;
        }
    }
예제 #7
0
STDMETHODIMP_(DeviceStreamState) CCustomPin::SetState(
    _In_ DeviceStreamState State
)
{
    HRESULT hr = S_OK;

    DMFTRACE(DMFT_GENERAL, TRACE_LEVEL_INFORMATION, "%!FUNC! Id:%d Transition into state: %d ", streamId(), State);

    DeviceStreamState oldState = setPreferredStreamState( State );

    if ( oldState != State )
    {
        ComPtr<IMFMediaType> preferredMediaType = nullptr;

        if (State == DeviceStreamState_Run)
        {
            GetMediaTypeAt(0, preferredMediaType.ReleaseAndGetAddressOf());
        }

        setPreferredMediaType(preferredMediaType.Get());
        setPreferredStreamState( State );

        {
            //
            // Notify the device transform manager that we have changed state
            //
            ComPtr<IMFMediaEvent> pEvent = nullptr;
            DMFTCHECKHR_GOTO( MFCreateMediaEvent(METransformInputStreamStateChanged, GUID_NULL, S_OK, NULL, pEvent.ReleaseAndGetAddressOf()), done );
            DMFTCHECKHR_GOTO( pEvent->SetUINT32(MF_EVENT_MFT_INPUT_STREAM_ID, streamId()), done );
            DMFTCHECKHR_GOTO( Parent()->QueueEvent(pEvent.Get()), done );
        }
        //
        // Wait to be notified back from the pipeline.
        //
        DMFTCHECKHR_GOTO( WaitForSetInputPinMediaChange(),done );
    }
done:
    DMFTRACE(DMFT_GENERAL, TRACE_LEVEL_INFORMATION, "%!FUNC! exiting %x = %!HRESULT!", hr, hr);
    return oldState;
}
예제 #8
0
// ---------------------------------------------------------------------------
// CStunTurnTests::TestCreateStreamL
// ---------------------------------------------------------------------------
//
void CStunTurnTests::TestCreateStreamL()
    {
    TUint sessionId( 0 );
    TUint sessionId2( 0 );
    TUint streamId( 0 );
    TUint streamId2( 0 );

    sessionId = iNat.CreateSessionL( iTestIapId, iTestDomain->Des() );
    
    iIfStub.StartActiveSchedulerL();
    
    RDebug::Print( _L( "\nTEST CASE: Create stream 1 in the session 1" ) );
    streamId = iNat.CreateStreamL( sessionId, iProtocol, KDefaultQos );
    
    RDebug::Print( _L( "\nTEST CASE: Create stream 2 in the session 1" ) );
    streamId2 = iNat.CreateStreamL( sessionId, iProtocol, KDefaultQos );
    
    RDebug::Print( _L( "TEST PRINT: CStunTurnTests::TestCreateStreamL, close stream 1" ) );
    iNat.CloseStreamL( sessionId, streamId );
    
    sessionId2 = iNat.CreateSessionL( iTestIapId, iTestDomain->Des() );
    
    iIfStub.StartActiveSchedulerL();
    
    RDebug::Print( _L( "\nTEST CASE: Create stream 3 in the session 2" ) ); 
    streamId = iNat.CreateStreamL( sessionId2, iProtocol, KDefaultQos );
    
    RDebug::Print( _L( "TEST PRINT: CStunTurnTests::TestCreateSessionL, close stream 3" ) );
    iNat.CloseStreamL( sessionId2, streamId );
    
    RDebug::Print( _L( "TEST PRINT: CStunTurnTests::TestCreateSessionL, close stream 2" ) );
    iNat.CloseStreamL( sessionId, streamId2 );
    
    RDebug::Print( _L( "TEST PRINT: CStunTurnTests::TestCreateSessionL, close session 1" ) );
    iNat.CloseSessionL( sessionId );
    
    RDebug::Print( _L( "TEST PRINT: CStunTurnTests::TestCreateSessionL, close session 2" ) );
    iNat.CloseSessionL( sessionId2 );
    }
예제 #9
0
static void StoreLongTermICEStatisticsImpl_m(
    nsresult result,
    nsAutoPtr<RTCStatsQuery> query) {

  if (NS_FAILED(result) ||
      !query->error.empty() ||
      !query->report->mIceCandidateStats.WasPassed()) {
    return;
  }

  query->report->mClosed.Construct(true);

  // First, store stuff in telemetry
  enum {
    REMOTE_GATHERED_SERVER_REFLEXIVE = 1,
    REMOTE_GATHERED_TURN = 1 << 1,
    LOCAL_GATHERED_SERVER_REFLEXIVE = 1 << 2,
    LOCAL_GATHERED_TURN_UDP = 1 << 3,
    LOCAL_GATHERED_TURN_TCP = 1 << 4,
    LOCAL_GATHERED_TURN_TLS = 1 << 5,
    LOCAL_GATHERED_TURN_HTTPS = 1 << 6,
  };

  // TODO([email protected]): Do we need to watch out for cases where the
  // components within a stream didn't have the same types of relayed
  // candidates? I have a feeling that late trickle could cause this, but right
  // now we don't have enough information to detect it (we would need to know
  // the ICE component id for each candidate pair and candidate)

  std::map<std::string, StreamResult> streamResults;

  // Build list of streams, and whether or not they failed.
  for (size_t i = 0;
       i < query->report->mIceCandidatePairStats.Value().Length();
       ++i) {
    const RTCIceCandidatePairStats &pair =
      query->report->mIceCandidatePairStats.Value()[i];

    if (!pair.mState.WasPassed() || !pair.mComponentId.WasPassed()) {
      MOZ_CRASH();
      continue;
    }

    // Note: this is not a "component" in the ICE definition, this is really a
    // stream ID. This is just the way the stats API is standardized right now.
    // Very confusing.
    std::string streamId(
      NS_ConvertUTF16toUTF8(pair.mComponentId.Value()).get());

    streamResults[streamId].streamSucceeded |=
      pair.mState.Value() == RTCStatsIceCandidatePairState::Succeeded;
  }

  for (size_t i = 0;
       i < query->report->mIceCandidateStats.Value().Length();
       ++i) {
    const RTCIceCandidateStats &cand =
      query->report->mIceCandidateStats.Value()[i];

    if (!cand.mType.WasPassed() ||
        !cand.mCandidateType.WasPassed() ||
        !cand.mComponentId.WasPassed()) {
      // Crash on debug, ignore this candidate otherwise.
      MOZ_CRASH();
      continue;
    }

    // Note: this is not a "component" in the ICE definition, this is really a
    // stream ID. This is just the way the stats API is standardized right now
    // Very confusing.
    std::string streamId(
      NS_ConvertUTF16toUTF8(cand.mComponentId.Value()).get());

    if (cand.mCandidateType.Value() == RTCStatsIceCandidateType::Relayed) {
      if (cand.mType.Value() == RTCStatsType::Localcandidate) {
        NS_ConvertUTF16toUTF8 transport(cand.mMozLocalTransport.Value());
        if (transport == kNrIceTransportUdp) {
          streamResults[streamId].candidateTypeBitpattern |=
            LOCAL_GATHERED_TURN_UDP;
        } else if (transport == kNrIceTransportTcp) {
          streamResults[streamId].candidateTypeBitpattern |=
            LOCAL_GATHERED_TURN_TCP;
        }
      } else {
        streamResults[streamId].candidateTypeBitpattern |= REMOTE_GATHERED_TURN;
      }
    } else if (cand.mCandidateType.Value() ==
               RTCStatsIceCandidateType::Serverreflexive) {
      if (cand.mType.Value() == RTCStatsType::Localcandidate) {
        streamResults[streamId].candidateTypeBitpattern |=
          LOCAL_GATHERED_SERVER_REFLEXIVE;
      } else {
        streamResults[streamId].candidateTypeBitpattern |=
          REMOTE_GATHERED_SERVER_REFLEXIVE;
      }
    }
  }

  for (auto i = streamResults.begin(); i != streamResults.end(); ++i) {
    if (i->second.streamSucceeded) {
      Telemetry::Accumulate(Telemetry::WEBRTC_CANDIDATE_TYPES_GIVEN_SUCCESS,
                            i->second.candidateTypeBitpattern);
    } else {
      Telemetry::Accumulate(Telemetry::WEBRTC_CANDIDATE_TYPES_GIVEN_FAILURE,
                            i->second.candidateTypeBitpattern);
    }
  }

  PeerConnectionCtx *ctx = GetPeerConnectionCtx();
  if (ctx) {
    ctx->mStatsForClosedPeerConnections.AppendElement(*query->report);
  }
}
// ---------------------------------------------------------------------------
// CNATFWStunConnectionHandler::SetSendingStateL
// ---------------------------------------------------------------------------
//
void CNATFWStunConnectionHandler::SetSendingStateL(
    const CNATFWCandidate& aLocalCandidate,
    TNATFWStreamingState aState,
    const TInetAddr& /*aDestAddr*/ )
    {
    __STUNPLUGIN( "CNATFWStunConnectionHandler::SetSendingStateL start" )
    
    TUint streamId( aLocalCandidate.StreamId() );
    TUint connId( 0 );
    TConnectionData* connection = NULL;
    TRAPD( err, GetConnectionIdL( aLocalCandidate, streamId, connId ) );
    
    if ( !err )
        {
        TInt streamInd( IndexByStreamId( streamId ) );
        connection = ConnectionById( streamInd, connId );
        }
    
    /*if ( connection )
        {
        // Client controls media connection, set address filtering
        iConnMux->SetAcceptedFromAddressL( streamId, connId, aDestAddr );
        
        if ( EStreamingStateActive == aState )
            {
            if ( connection->iSendingActivated && connection->iDestAddr.
                CmpAddr( aDestAddr ) )
                {
                iAsyncCallback->MakeCallbackL( TStunPluginCallbackInfo::
                    EActiveSending, streamId, KErrNone, NULL );
                }
            else
                {
                connection->iDestAddr.SetAddress( aDestAddr.Address() );
                connection->iDestAddr.SetPort( aDestAddr.Port() );
                
                iConnMux->SetSendingStateL( streamId, connId, aDestAddr,
                    EStreamingStateActive );
                }
            }
        else
            {
            if ( !connection->iSendingActivated )
                {
                iAsyncCallback->MakeCallbackL( TStunPluginCallbackInfo::
                    EDeactiveSending, streamId, KErrNone, NULL );
                }
            else
                {
                iConnMux->SetSendingStateL( streamId, connId, aDestAddr,
                    EStreamingStatePassive );
                }
            }
        }
    else
        {*/
        if ( EStreamingStateActive == aState )
            {
            iAsyncCallback->MakeCallbackL( TStunPluginCallbackInfo::
                EActiveSending, streamId, KErrNone, NULL );
            }
        else
            {
            iAsyncCallback->MakeCallbackL( TStunPluginCallbackInfo::
                EDeactiveSending, streamId, KErrNone, NULL );
            }
        //}
    
    __STUNPLUGIN( "CNATFWStunConnectionHandler::SetSendingStateL end" )
    }
// ---------------------------------------------------------------------------
// CNATFWStunConnectionHandler::SetReceivingStateL
// ---------------------------------------------------------------------------
//
void CNATFWStunConnectionHandler::SetReceivingStateL(
    const CNATFWCandidate& aLocalCandidate,
    TNATFWStreamingState aState )
    {
    __STUNPLUGIN( "CNATFWStunConnectionHandler::SetReceivingStateL start" )
    
    TUint streamId( aLocalCandidate.StreamId() );
    TUint connId( 0 );
    TConnectionData* connection = NULL;
    TRAPD( err, GetConnectionIdL( aLocalCandidate, streamId, connId ) );
    
    if ( !err )
        {
        TInt streamInd( IndexByStreamId( streamId ) );
        connection = ConnectionById( streamInd, connId );
        }
    
    /*if ( connection )
        {
        if ( EStreamingStateActive == aState )
            {
            if ( connection->iReceivingActivated  )
                {
                iAsyncCallback->MakeCallbackL( TStunPluginCallbackInfo::
                    EActiveReceiving, streamId, KErrNone, NULL );
                }
            else
                {
                iConnMux->SetReceivingStateL( streamId, connId,
                    EStreamingStateActive );
                }
            }
        else
            {
            if ( !connection->iReceivingActivated )
                {
                iAsyncCallback->MakeCallbackL( TStunPluginCallbackInfo::
                    EDeactiveReceiving, streamId, KErrNone, NULL );
                }
            else
                {
                iConnMux->SetReceivingStateL( streamId, connId,
                    EStreamingStatePassive );
                }
            }
        }
    else
        {*/
        if ( EStreamingStateActive == aState )
            {
            iAsyncCallback->MakeCallbackL( TStunPluginCallbackInfo::
                EActiveReceiving, streamId, KErrNone, NULL );
            }
        else
            {
            iAsyncCallback->MakeCallbackL( TStunPluginCallbackInfo::
                EDeactiveReceiving, streamId, KErrNone, NULL );
            }
        //}
    
    __STUNPLUGIN( "CNATFWStunConnectionHandler::SetReceivingStateL end" )
    }
예제 #12
0
//
// Process input calls the pin here.. In this code sample we
// don't send it anywhere. It is simply shortcircuited back to the pipeline
//
STDMETHODIMP CCustomPin::SendSample(
    _In_ IMFSample *pSample
)
{
    //
    // Log sample and exit.. The pipeline will just keep on churning more samples till
    // We go into the stop state
    //
    DMFTRACE(DMFT_GENERAL, TRACE_LEVEL_INFORMATION, "%!FUNC! Custom Pin %d recieved Sample %p", streamId(), pSample);

    return S_OK;
}
void UT_CMccRtpDataSource::UT_CMccRtpDataSource_ValidatePacketL()
    {
    TRtpId streamId( KNullId );
    TRtpRecvHeader header;

    TBuf8<5> data5;
    TBuf8<15> data15;
    data5.Format( _L8( "foo42" ) );
    data15.Format( _L8( "foo42foo42foo42" ) );

    // Data too big, stream ok, wrong payload type
    EUNIT_ASSERT_LEAVE( iSource->ValidatePacketL( streamId, header, data15 ) );

    // Data ok, stream ok, wrong payload type
    EUNIT_ASSERT_LEAVE( iSource->ValidatePacketL( streamId, header, data5 ) );

    header.iPayloadType = KMccPayloadTypeMax;

    // header not OK
    CMMFDataBuffer* buffer = CMMFDataBuffer::NewL(10);
    CleanupStack::PushL( buffer );
    iSource->iBufferToFill = buffer;
    EUNIT_ASSERT_LEAVE( iSource->ValidatePacketL( streamId, header, data5 ) );
    
    // Get a new source
    //Teardown();
    if( iRtpKeepaliveMechanism )
    	{
    	delete iRtpKeepaliveMechanism;
    	iRtpKeepaliveMechanism = NULL;
    	}
    
    if ( iSource )
        {
        delete iSource;
        iSource = NULL;
        }
    //SetupL();
    TUid dummyUid( TUid::Uid( 42 ) ); 
    TBuf8<5> dummyBuf( _L8( "foo" ) );
    iSource = static_cast<CMccRtpDataSource*>(
        CMccRtpDataSource::NewSourceL( dummyUid, dummyBuf ) );
    
    TMccRtpSourceSetting setting;
    setting.iStandByTimerValue = 3000;   
    TMccRtpSourceSettingBuf settingBuf( setting );
    iSource->ConstructSourceL( settingBuf );
    
    MAsyncEventHandler* eventHandler = NULL;
    TRtpId rtpSessionId(0);
    iRtpKeepaliveMechanism = 
        CMccRtpKeepaliveContainer::NewL( *eventHandler, 
                                         *iRtpApi, 
                                         rtpSessionId ); 

    TMccRtpSessionParams params;
    params.iRtpAPI = iRtpApi;
    params.iSessionId = iSession;
    params.iEnableRTCP = EFalse;
    params.iRtpKeepalive = iRtpKeepaliveMechanism;
    EUNIT_ASSERT_NO_LEAVE( iSource->SetSessionParamsL( params ) );

    TMccCodecInfo cInfo;
    cInfo.iFourCC = TFourCC( KMccFourCCIdG711 );
    cInfo.iEnableDTX = ETrue;
    TMccCodecInfoBuffer cInfoBuf( cInfo );
    EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf, iRtpMediaClock ) );

    header.iPayloadType = KPcmuPayloadType;

    // Data ok, stream ok, payload type ok    
    CAmrPayloadFormatRead* amrPfRead = CAmrPayloadFormatRead::NewL( NULL );
    CleanupStack::PushL( amrPfRead );
    
    RArray<TUint> payloads;
    CleanupClosePushL( payloads );
    payloads.AppendL( KPcmuPayloadType );
    iSource->RegisterPayloadTypesL( payloads );
    iSource->FillBufferL( buffer, amrPfRead, TMediaId() );
    EUNIT_ASSERT_NO_LEAVE( iSource->ValidatePacketL( streamId, header, data5 ) );
    CleanupStack::PopAndDestroy( &payloads );
    CleanupStack::PopAndDestroy( amrPfRead );
    CleanupStack::PopAndDestroy( buffer );
    
    }
예제 #14
0
// ---------------------------------------------------------------------------
// CStunTurnTests::TestFetchCandidateL
// ---------------------------------------------------------------------------
//
void CStunTurnTests::TestFetchCandidateL()
    {
    TUint sessionId( 0 );
    TUint sessionId2( 0 );
    
    TUint streamId( 0 );
    TUint streamId2( 0 );
    TUint streamId3( 0 );
    
    TInt error;
    TInt loadedPluginInd( 0 );
     
    RDebug::Print( _L( "TEST PRINT: Create session" ) );
    sessionId = iNat.CreateSessionL( iTestIapId, iTestDomain->Des() );
    
    iIfStub.StartActiveSchedulerL();
    
    RDebug::Print( _L( "TEST PRINT: Create stream" ) );
    streamId = iNat.CreateStreamL( sessionId, iProtocol, KDefaultQos );
    
    RDebug::Print( _L( "TEST PRINT: Load plugin" ) );   
    iNat.LoadPluginL( sessionId, *iPlugins, loadedPluginInd );
    iIfStub.StartActiveSchedulerL( KPluginLoadTime );
    
    RDebug::Print( _L( "\nTEST CASE: Fetch Candidate to the stream" ) );
    TRAPD( err, iNat.FetchCandidateL( sessionId, streamId, KAfInet ) );
    if ( err )
        {
        RDebug::Print( _L( "\nTEST PRINT: CNATFWClient::FetchCandidateL LEAVE %d" ), err );
        iNat.CloseStreamL( sessionId, streamId );
        iNat.CloseSessionL( sessionId );
        User::Leave( err );
        }
        
    error = iIfStub.StartActiveSchedulerL( /*KRunningTime*/ );
    
    RDebug::Print( _L( "TEST PRINT: Close the stream and the session" ) );
    iNat.CloseStreamL( sessionId, streamId );
    iNat.CloseSessionL( sessionId );
    
    __ASSERT_ALWAYS( !error, User::Leave( error ));
 
    RDebug::Print( _L( "TEST PRINT: Create session 1" ) );
    sessionId = iNat.CreateSessionL( iTestIapId, iTestDomain->Des() );
    
    iIfStub.StartActiveSchedulerL();
    
    RDebug::Print( _L( "TEST PRINT: Load plugin to session 1" ) );   
    iNat.LoadPluginL( sessionId, *iPlugins, loadedPluginInd );
    iIfStub.StartActiveSchedulerL( KPluginLoadTime );
    
    RDebug::Print( _L( "TEST PRINT: Create stream 1 to the session 1" ) );
    streamId = iNat.CreateStreamL( sessionId, iProtocol, KDefaultQos );

    RDebug::Print( _L( "\nTEST CASE: Fetch Candidate to the stream 1 in the session 1" ) );
    TRAP( err, iNat.FetchCandidateL( sessionId, streamId, KAfInet ) );
    if( err )
        {
        RDebug::Print( _L( "\nTEST PRINT: CNATFWClient::FetchCandidateL LEAVE %d" ), err );
        iNat.CloseStreamL( sessionId, streamId );
        iNat.CloseSessionL( sessionId );
        User::Leave( err );
        }
    
    iIfStub.StartActiveSchedulerL();
    
    RDebug::Print( _L( "TEST PRINT: Create stream 2 to the session 1" ) );
    streamId2 = iNat.CreateStreamL( sessionId, iProtocol, KDefaultQos );
    
    RDebug::Print( _L( "\nTEST CASE: Fetch Candidate to the stream 2 in the session 1" ) );
    
    TRAP( err, iNat.FetchCandidateL( sessionId, streamId2, KAfInet ) );
    if( err )
        {
        RDebug::Print( _L( "\nTEST PRINT: CNATFWClient::FetchCandidateL LEAVE %d" ), err );
        iNat.CloseStreamL( sessionId, streamId );
        iNat.CloseStreamL( sessionId, streamId2 );
        iNat.CloseSessionL( sessionId );
        User::Leave( err );
        }
    
    error = iIfStub.StartActiveSchedulerL( KRunningTime );
    
    if( !error )
        {
        RDebug::Print( _L( "TEST PRINT: Create session 2" ) );
        sessionId2 = iNat.CreateSessionL( iTestIapId, iTestDomain->Des() );
        
        iIfStub.StartActiveSchedulerL();
        
        RDebug::Print( _L( "TEST PRINT: Load plugin to session 2" ) );   
        iNat.LoadPluginL( sessionId2, *iPlugins, loadedPluginInd );
        iIfStub.StartActiveSchedulerL( KPluginLoadTime );
        
        RDebug::Print( _L( "TEST PRINT: Create stream 3 to the session 2" ) );
        streamId3 = iNat.CreateStreamL( sessionId2, iProtocol, KDefaultQos );
        
        RDebug::Print( _L( "\nTEST CASE: Fetch Candidate to the stream 3 in the session 2" ) );
        
        TRAP( err, iNat.FetchCandidateL( sessionId2, streamId3, KAfInet ) );
        if( err )
        {
        RDebug::Print( _L( "\nTEST PRINT: CNATFWClient::FetchCandidateL LEAVE %d" ), err );
        iNat.CloseStreamL( sessionId2, streamId3 );
        iNat.CloseSessionL( sessionId2 );
        iNat.CloseStreamL( sessionId, streamId );
        iNat.CloseStreamL( sessionId, streamId2 );
        iNat.CloseSessionL( sessionId );
        User::Leave( err );
        }
        
        iIfStub.StartActiveSchedulerL( KRunningTime ); 
        
        RDebug::Print( _L( "TEST PRINT: Close stream 3 and session 2" ) );
        iNat.CloseStreamL( sessionId2, streamId3 );
        iNat.CloseSessionL( sessionId2 );
        }
        
    RDebug::Print( _L( "TEST PRINT: Close streams 1 & 2 and session 1" ) );
    iNat.CloseStreamL( sessionId, streamId );
    iNat.CloseStreamL( sessionId, streamId2 );

    iNat.CloseSessionL( sessionId );
    
    __ASSERT_ALWAYS( !error, User::Leave( error ));
    }
예제 #15
0
void Transfer::setStreamId(const QString &si) {
    if (si != streamId()) {
        m_streamId = si;
        emit streamIdChanged();
    }
}
예제 #16
0
// ---------------------------------------------------------------------------
// CTestDtmf::TestStreamControlL
// ---------------------------------------------------------------------------
//
void CTestDtmf::TestStreamControlL( TDtmfSignalType aSigType )
    {
    TMccNetSettings tempSettings = iNetsettings;
    
    CMccInterfaceStub* stub = CMccInterfaceStub::NewL();
    CleanupStack::PushL( stub );
    CMccInterface* interface = CMccInterface::NewL( *stub );
    CleanupStack::PushL( interface );
    
    TUint32 sessionId;
    User::LeaveIfError( interface->CreateSession( sessionId ) );
    
    TUint32 linkId;
    TInt linkType( KMccLinkGeneral );
    User::LeaveIfError( interface->CreateLink( sessionId, linkType, linkId,
        tempSettings ) );
    stub->WaitForEvent( sessionId, linkId, 0, KMccLinkCreated );
    
    CMccCodecInformation* cInfo 
        = FetchCodecByMimeSubtypeNameL( *interface, KTxtDtmf );
    CleanupStack::PushL( cInfo );
    
    if ( aSigType == EInbandSignal )
        {
        cInfo->SetCodecMode( EDTMFModeInband );
        }
    else
        {
        cInfo->SetCodecMode( EDTMFModeEvent );
        }
    
    TUint32 streamId( 0 );
    TUint32 sinkId( 0 ), sourceId( 0 );
    interface->AddDataSink( KMccRtpSinkUid, KNullDesC8, sinkId );
    interface->AddDataSource( KMccRtpSourceUid, KNullDesC8, sourceId );
    
    User::LeaveIfError( interface->CreateStream( sessionId, linkId, streamId,
        KMccDtmfStream, *cInfo ) );
    
    // TEST CORRECT CONTROL PATHS
    User::LeaveIfError ( interface->PrepareStream( sessionId, linkId, streamId ) );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamPrepared );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamPrepared );
   
    User::LeaveIfError ( interface->StartStream( sessionId, linkId, streamId ) );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamStarted );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamStarted );
    
    User::LeaveIfError ( interface->PauseStream( sessionId, linkId, streamId ) );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamPaused );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamPaused );
    
    User::LeaveIfError ( interface->ResumeStream( sessionId, linkId, streamId ) );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamResumed );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamResumed );
    
    User::LeaveIfError ( interface->StopStream( sessionId, linkId, streamId ) );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamStopped );
    stub->WaitForEvent( sessionId, linkId, streamId, KMccStreamStopped );
    
    // TBD: TEST INVALID CONTROL PATHS
    
    User::LeaveIfError( interface->DeleteStream( sessionId, linkId, streamId ) );
    User::LeaveIfError( interface->CloseLink( sessionId, linkId ) );
    User::LeaveIfError( interface->CloseSession( sessionId ) );
    
    CleanupStack::PopAndDestroy( cInfo );
    CleanupStack::PopAndDestroy( interface );
    CleanupStack::PopAndDestroy( stub );
    }