Commit 72c406d0 authored by Edric Milaret's avatar Edric Milaret Committed by Guillaume Roguez

QtClient: fix for video

Refs #71984

Change-Id: I7fd756d52e9a54516710ce7748911020dfe7b7e6
parent 627500d9
This diff is collapsed.
......@@ -169,10 +169,12 @@ CallWidget::on_callList_activated(const QModelIndex &index)
if (actualCall_ != nullptr) {
if (callSelected == actualCall_)
return;
ui->videoWidget->hide();
actualCall_->performAction(Call::Action::HOLD);
}
actualCall_ = callSelected;
actualCall_->performAction(Call::Action::HOLD);
ui->videoWidget->show();
}
void
......
......@@ -133,6 +133,7 @@ ConfigurationWidget::accountSelected(QItemSelection itemSel) {
void
ConfigurationWidget::on_testVideoButton_toggled(bool checked)
{
checked ? ui->videoView->show() : ui->videoView->hide();
checked ? Video::PreviewManager::instance()->startPreview()
: Video::PreviewManager::instance()->stopPreview();
}
......
......@@ -29,12 +29,7 @@ VideoWidget::VideoWidget(QWidget *parent) :
{
connect(Video::PreviewManager::instance(),
SIGNAL(previewStarted(Video::Renderer*)),
this, SLOT(previewStarted(Video::Renderer*)),
Qt::ConnectionType::DirectConnection);
connect(Video::PreviewManager::instance(),
SIGNAL(previewStopped(Video::Renderer*)),
this, SLOT(previewStopped(Video::Renderer*)),
Qt::ConnectionType::DirectConnection);
this, SLOT(previewStarted(Video::Renderer*)));
connect(CallModel::instance(),
SIGNAL(rendererAdded(Call*,Video::Renderer*)),
this, SLOT(callInitiated(Call*, Video::Renderer*)),
......@@ -46,19 +41,20 @@ VideoWidget::~VideoWidget()
void
VideoWidget::previewStarted(Video::Renderer *renderer) {
if (previewRenderer_)
disconnect(previewRenderer_, 0,0,0);
previewRenderer_ = renderer;
connect(previewRenderer_, SIGNAL(frameUpdated()),
this, SLOT(frameFromPreview()));
connect(previewRenderer_, SIGNAL(stopped()),
this, SLOT(renderingStopped()), Qt::ConnectionType::DirectConnection);
this, SLOT(previewStopped()));
}
void
VideoWidget::previewStopped(Video::Renderer* renderer) {
Q_UNUSED(renderer)
disconnect(previewRenderer_, 0,0,0);
VideoWidget::previewStopped() {
QMutexLocker {&lock_};
disconnect(previewRenderer_, SIGNAL(frameUpdated()),
this, SLOT(frameFromPreview()));
disconnect(previewRenderer_, SIGNAL(stopped()),
this, SLOT(renderingStopped()));
previewRenderer_ = nullptr;
}
......@@ -73,8 +69,8 @@ VideoWidget::frameFromPreview() {
previewFrame_ = new QImage(
(const uchar*)previewRenderer_->currentFrame().constData(),
size.width(), size.height(), QImage::Format_RGBA8888);
update();
}
update();
}
void
......@@ -107,7 +103,6 @@ VideoWidget::callInitiated(Call* call, Video::Renderer *renderer) {
void
VideoWidget::frameFromDistant() {
QMutexLocker {&lock_};
if (distantFrame_) {
delete distantFrame_;
distantFrame_ = nullptr;
......@@ -117,8 +112,8 @@ VideoWidget::frameFromDistant() {
distantFrame_ = new QImage(
(const uchar*) renderer_->currentFrame().constData(),
size.width(), size.height(), QImage::Format_RGBA8888);
update();
}
update();
}
void
......@@ -128,8 +123,7 @@ VideoWidget::renderingStopped() {
delete distantFrame_;
distantFrame_ = nullptr;
}
disconnect(renderer_, 0,0,0);
disconnect(previewRenderer_, 0,0,0);
previewRenderer_ = nullptr;
disconnect(renderer_, SIGNAL(frameUpdated()), this, SLOT(frameFromDistant()));
disconnect(renderer_, SIGNAL(stopped()),this, SLOT(renderingStopped()));
renderer_ = nullptr;
}
......@@ -38,7 +38,7 @@ public:
public slots:
void previewStarted(Video::Renderer* renderer);
void previewStopped(Video::Renderer* renderer);
void previewStopped();
void frameFromPreview();
void callInitiated(Call *call, Video::Renderer *renderer);
void frameFromDistant();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment