Ejemplo n.º 1
0
    void VoiceSession::OnStreamRemoved(const Tp::MediaStreamPtr &stream)
    {
        if (stream->type() == Tp::MediaStreamTypeAudio)
        {
            LogDebug("Removed AUDIO STREAM");
            emit AudioStreamStateChanged(SS_DISCONNECTED);
        }

        if (stream->type() == Tp::MediaStreamTypeVideo)
        {
            LogDebug("Removed VIDEO STREAM");
            emit VideoStreamStateChanged(SS_DISCONNECTED);
        }
    }
Ejemplo n.º 2
0
    void VoiceSession::OnStreamStateChanged(const Tp::MediaStreamPtr &stream, Tp::MediaStreamState state)
    {
        QString type = "UNKNOWN";
        if (stream->type() == Tp::MediaStreamTypeAudio)
            type="AUDIO";
        if (stream->type() == Tp::MediaStreamTypeVideo)
            type="VIDEO";

        QString log_message = type;

        switch(state)
        {
        case Tp::MediaStreamStateDisconnected:
            if (stream->type() == Tp::MediaStreamTypeAudio)
                emit AudioStreamStateChanged(SS_DISCONNECTED);
            if (stream->type() == Tp::MediaStreamTypeVideo)
                emit VideoStreamStateChanged(SS_DISCONNECTED);
            log_message.append(" stream state changed to: DISCONNECT");
            break;
        case Tp::MediaStreamStateConnecting:
            if (stream->type() == Tp::MediaStreamTypeAudio)
                emit AudioStreamStateChanged(SS_CONNECTING);
            if (stream->type() == Tp::MediaStreamTypeVideo)
                emit VideoStreamStateChanged(SS_CONNECTING);
            log_message.append(" stream state changed to: CONNECTING...");
            break;
        case Tp::MediaStreamStateConnected:
            if (stream->type() == Tp::MediaStreamTypeAudio)
                emit AudioStreamStateChanged(SS_CONNECTED);
            if (stream->type() == Tp::MediaStreamTypeVideo)
                emit VideoStreamStateChanged(SS_CONNECTED);
            log_message.append(" stream state changed to: CONNECTED");
            break;
        }
        LogDebug(log_message.toStdString());
    }
Ejemplo n.º 3
0
    VideoSessionWidget::VideoSessionWidget(QWidget *parent, Communication::VoiceSessionInterface *video_session, QString &my_name, QString &his_name)
        : QWidget(parent),
          video_session_(video_session),
          my_name_(my_name),
          his_name_(his_name),
          internal_widget_(0),
          internal_v_layout_(0),
          internal_h_layout_(0),
          internal_v_layout_local_(0),
          internal_v_layout_remote_(0),
          local_video_(0),
          remote_video_(0),
          controls_local_widget_(new QWidget(this)),
          controls_remote_widget_(new QWidget(this)),
          main_view_visible_(false)

    {
        // Init all ui elements
        video_session_ui_.setupUi(this);

        controls_local_ui_.setupUi(controls_local_widget_);
        controls_local_ui_.videoCheckBox->setStyleSheet(QString("color:red"));
        controls_local_ui_.horizontalLayout->insertSpacerItem(2, new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed));
        controls_local_widget_->hide();  

        controls_remote_ui_.setupUi(controls_remote_widget_);
        controls_remote_ui_.videoCheckBox->setStyleSheet(QString("color:red"));
        controls_remote_ui_.horizontalLayout->insertSpacerItem(0, new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed));
        controls_remote_ui_.audioCheckBox->setEnabled(false);
        controls_remote_ui_.videoCheckBox->setEnabled(false);
        controls_remote_widget_->hide();
        
        // Update widget states
        SessionStateChanged(video_session_->GetState());
        AudioStreamStateChanged(video_session_->GetAudioStreamState());
        VideoStreamStateChanged(video_session_->GetVideoStreamState());
        UpdateLocalVideoControls(video_session_->IsSendingVideoData());
        UpdateLocalAudioControls(video_session_->IsSendingAudioData());
        UpdateRemoteVideoControls(video_session_->IsReceivingVideoData());
        UpdateRemoteAudioControls(video_session_->IsReceivingAudioData());

        // CLOSE TAB
        connect(video_session_ui_.closePushButton, SIGNAL( clicked() ),
                this, SLOT( CloseSession() ));
        // CONNECTION AND STREAM STATES
        connect(video_session_, SIGNAL( StateChanged(Communication::VoiceSessionInterface::State) ),
                this, SLOT( SessionStateChanged(Communication::VoiceSessionInterface::State) ));
        connect(video_session_, SIGNAL( AudioStreamStateChanged(Communication::VoiceSessionInterface::StreamState) ),
                this, SLOT( AudioStreamStateChanged(Communication::VoiceSessionInterface::StreamState) ));
        connect(video_session_, SIGNAL( VideoStreamStateChanged(Communication::VoiceSessionInterface::StreamState) ),
                this, SLOT( VideoStreamStateChanged(Communication::VoiceSessionInterface::StreamState) ));
        // AUDIO / VIDEO STATES
        connect(video_session_, SIGNAL( SendingVideoData(bool) ),
                this, SLOT( UpdateLocalVideoControls(bool) ));
        connect(video_session_, SIGNAL( SendingAudioData(bool) ),
                this, SLOT( UpdateLocalAudioControls(bool) ));
        connect(video_session_, SIGNAL( ReceivingVideoData(bool) ),
                this, SLOT( UpdateRemoteVideoControls(bool) ));
        connect(video_session_, SIGNAL( ReceivingAudioData(bool) ),
                this, SLOT( UpdateRemoteAudioControls(bool) ));
    }