diff --git a/linphone-app/src/components/camera/Camera.cpp b/linphone-app/src/components/camera/Camera.cpp index 8c4e879ac..9d2737386 100644 --- a/linphone-app/src/components/camera/Camera.cpp +++ b/linphone-app/src/components/camera/Camera.cpp @@ -45,7 +45,7 @@ int Camera::mPreviewCounter; // ============================================================================= Camera::Camera (QQuickItem *parent) : QQuickFramebufferObject(parent) { - qDebug() << "[Camera] Camera constructor" << this; + qDebug() << "[Camera] (" << mQmlName << ") Camera constructor" << this; updateWindowIdLocation(); setTextureFollowsItemSize(true); // The fbo content must be y-mirrored because the ms rendering is y-inverted. @@ -67,7 +67,7 @@ Camera::Camera (QQuickItem *parent) : QQuickFramebufferObject(parent) { } Camera::~Camera(){ - qDebug() << "[Camera] Camera destructor" << this; + qDebug() << "[Camera] (" << mQmlName << ") Camera destructor" << this; mRefreshTimer->stop(); if(mIsPreview) @@ -109,7 +109,7 @@ void Camera::resetWindowId() const{ if(mLinphonePlayer && mLinphonePlayer->getLinphonePlayer()) mLinphonePlayer->getLinphonePlayer()->setWindowId(nullptr); } - qDebug() << "[Camera] Removed " << oldRenderer << " at " << mWindowIdLocation << " for " << this; + qInfo() << "[Camera] (" << mQmlName << ") Removed " << oldRenderer << " at " << mWindowIdLocation << " for " << this; mIsWindowIdSet = false; } } @@ -181,7 +181,7 @@ void Camera::removeLinphonePlayer(){ QQuickFramebufferObject::Renderer *Camera::createRenderer () const { QQuickFramebufferObject::Renderer * renderer = NULL; if(mWindowIdLocation == CorePreview){ - qDebug() << "[Camera] Setting Camera to Preview"; + qInfo() << "[Camera] (" << mQmlName << ") Setting Camera to Preview"; renderer=(QQuickFramebufferObject::Renderer *)CoreManager::getInstance()->getCore()->createNativePreviewWindowId(); if(renderer) CoreManager::getInstance()->getCore()->setNativePreviewWindowId(renderer); @@ -189,7 +189,7 @@ QQuickFramebufferObject::Renderer *Camera::createRenderer () const { if(mCallModel){ auto call = mCallModel->getCall(); if(call){ - qDebug() << "[Camera] Setting Camera to CallModel"; + qInfo() << "[Camera] (" << mQmlName << ") Setting Camera to CallModel"; renderer = (QQuickFramebufferObject::Renderer *) call->createNativeVideoWindowId(); if(renderer) call->setNativeVideoWindowId(renderer); @@ -198,21 +198,21 @@ QQuickFramebufferObject::Renderer *Camera::createRenderer () const { }else if( mWindowIdLocation == Device) { auto participantDevice = mParticipantDeviceModel->getDevice(); if(participantDevice){ - qDebug() << "[Camera] Setting Camera to Participant Device"; - qDebug() << "[Camera] Trying to create new window ID for " << participantDevice->getName().c_str() << ", addr=" << participantDevice->getAddress()->asString().c_str(); + qInfo() << "[Camera] (" << mQmlName << ") Setting Camera to Participant Device"; + qInfo() << "[Camera] (" << mQmlName << ") Trying to create new window ID for " << participantDevice->getName().c_str() << ", addr=" << participantDevice->getAddress()->asString().c_str(); renderer = (QQuickFramebufferObject::Renderer *) participantDevice->createNativeVideoWindowId(); if(renderer) participantDevice->setNativeVideoWindowId(renderer); } }else if( mWindowIdLocation == Core){ - qDebug() << "[Camera] Setting Camera to Default Window"; + qInfo() << "[Camera] (" << mQmlName << ") Setting Camera to Default Window"; renderer = (QQuickFramebufferObject::Renderer *) CoreManager::getInstance()->getCore()->createNativeVideoWindowId(); if(renderer) CoreManager::getInstance()->getCore()->setNativeVideoWindowId(renderer); }else if( mWindowIdLocation == Player){ auto player = mLinphonePlayer->getLinphonePlayer(); if(player){ - qDebug() << "[Camera] Setting Camera to Player"; + qInfo() << "[Camera] (" << mQmlName << ") Setting Camera to Player"; renderer = (QQuickFramebufferObject::Renderer *) player->createWindowId(); if(renderer) player->setWindowId(renderer); @@ -220,13 +220,13 @@ QQuickFramebufferObject::Renderer *Camera::createRenderer () const { } if( !renderer){ QTimer::singleShot(1, this, &Camera::isNotReady);// Workaround for const createRenderer - qWarning() << "[Camera] Stream couldn't start for Rendering. Retrying in 1s"; + qWarning() << "[Camera] (" << mQmlName << ") Stream couldn't start for Rendering. Retrying in 1s"; renderer = new CameraDummy(); QTimer::singleShot(1000, this, &Camera::requestNewRenderer); }else{ mIsWindowIdSet = true; - qDebug() << "[Camera] Added " << renderer << " at " << mWindowIdLocation << " for " << this; + qInfo() << "[Camera] (" << mQmlName << ") Added " << renderer << " at " << mWindowIdLocation << " for " << this; QTimer::singleShot(1, this, &Camera::isReady);// Workaround for const createRenderer. } return renderer; @@ -254,6 +254,10 @@ SoundPlayer * Camera::getLinphonePlayer() const{ return mLinphonePlayer; } +QString Camera::getQmlName() const{ + return mQmlName; +} + void Camera::setCallModel (CallModel *callModel) { if (mCallModel != callModel) { if( mCallModel){ @@ -314,6 +318,13 @@ void Camera::setLinphonePlayer(SoundPlayer *player){ } } +void Camera::setQmlName(const QString& name){ + if(name != mQmlName){ + mQmlName = name; + emit qmlNameChanged(); + } +} + void Camera::isReady(){ setIsReady(true); } diff --git a/linphone-app/src/components/camera/Camera.hpp b/linphone-app/src/components/camera/Camera.hpp index c544d05f4..399f02b4c 100644 --- a/linphone-app/src/components/camera/Camera.hpp +++ b/linphone-app/src/components/camera/Camera.hpp @@ -48,6 +48,7 @@ class Camera : public QQuickFramebufferObject { Q_PROPERTY(bool isPreview READ getIsPreview WRITE setIsPreview NOTIFY isPreviewChanged); Q_PROPERTY(bool isReady READ getIsReady WRITE setIsReady NOTIFY isReadyChanged); Q_PROPERTY(SoundPlayer * linphonePlayer READ getLinphonePlayer WRITE setLinphonePlayer NOTIFY linphonePlayerChanged) + Q_PROPERTY(QString qmlName READ getQmlName WRITE setQmlName NOTIFY qmlNameChanged) typedef enum{ None = -1, @@ -83,6 +84,7 @@ signals: void requestNewRenderer(); void videoDefinitionChanged(); void linphonePlayerChanged(SoundPlayer * linphonePlayer); + void qmlNameChanged(); private: CallModel *getCallModel () const; @@ -90,6 +92,7 @@ private: bool getIsReady () const; ParticipantDeviceModel * getParticipantDeviceModel() const; SoundPlayer * getLinphonePlayer() const; + QString getQmlName() const; void setCallModel (CallModel *callModel); void setIsPreview (bool status); @@ -97,6 +100,7 @@ private: void setParticipantDeviceModel(ParticipantDeviceModel * participantDeviceModel); void setLinphonePlayer(SoundPlayer *player); void setWindowIdLocation(const WindowIdLocation& location); + void setQmlName(const QString& name); void activatePreview(); void deactivatePreview(); @@ -113,6 +117,7 @@ private: CallModel *mCallModel = nullptr; ParticipantDeviceModel *mParticipantDeviceModel = nullptr; SoundPlayer * mLinphonePlayer = nullptr; + QString mQmlName; WindowIdLocation mWindowIdLocation = None; mutable bool mIsWindowIdSet = false; diff --git a/linphone-app/ui/modules/Linphone/Camera/CameraItem.qml b/linphone-app/ui/modules/Linphone/Camera/CameraItem.qml index 2eca6d422..4dd1294cf 100644 --- a/linphone-app/ui/modules/Linphone/Camera/CameraItem.qml +++ b/linphone-app/ui/modules/Linphone/Camera/CameraItem.qml @@ -19,6 +19,7 @@ Item { property ParticipantDeviceModel currentDevice property CallModel callModel property SoundPlayer linphonePlayer + property string qmlName property bool isPreview: (!callModel && !container.currentDevice) || ( container.currentDevice && container.currentDevice.isMe) property bool isFullscreen: false property bool hideCamera: false @@ -77,6 +78,7 @@ Item { Component { id: camera Camera { + qmlName: container.qmlName participantDeviceModel: container.currentDevice linphonePlayer: container.linphonePlayer call: container.isCameraFromDevice ? null : container.callModel diff --git a/linphone-app/ui/modules/Linphone/Camera/CameraView.qml b/linphone-app/ui/modules/Linphone/Camera/CameraView.qml index 8f5414d65..6d8dd2bd8 100644 --- a/linphone-app/ui/modules/Linphone/Camera/CameraView.qml +++ b/linphone-app/ui/modules/Linphone/Camera/CameraView.qml @@ -21,6 +21,7 @@ Item{ property alias isPreview: camera.isPreview property alias isFullscreen: camera.isFullscreen property alias isCameraFromDevice: camera.isCameraFromDevice + property alias qmlName: camera.qmlName property bool showCloseButton: false property bool showActiveSpeakerOverlay: true property color color : camera.isReady ? CameraViewStyle.cameraBackgroundColor : CameraViewStyle.outBackgroundColor diff --git a/linphone-app/ui/modules/Linphone/Sticker/CameraSticker.qml b/linphone-app/ui/modules/Linphone/Sticker/CameraSticker.qml index 167cee8c5..e5cd51008 100644 --- a/linphone-app/ui/modules/Linphone/Sticker/CameraSticker.qml +++ b/linphone-app/ui/modules/Linphone/Sticker/CameraSticker.qml @@ -23,6 +23,7 @@ DecorationSticker{ property alias isCameraFromDevice: camera.isCameraFromDevice property alias isReady: camera.isReady property alias isVideoEnabled: camera.isVideoEnabled + property alias cameraQmlName: camera.qmlName property bool showCloseButton: false property bool showActiveSpeakerOverlay: true property color color : CameraStickerStyle.cameraBackgroundColor diff --git a/linphone-app/ui/modules/Linphone/Sticker/Sticker.qml b/linphone-app/ui/modules/Linphone/Sticker/Sticker.qml index 7b9dae4d5..0a1b539d3 100644 --- a/linphone-app/ui/modules/Linphone/Sticker/Sticker.qml +++ b/linphone-app/ui/modules/Linphone/Sticker/Sticker.qml @@ -36,6 +36,7 @@ Item{ property alias isCameraFromDevice: camera.isCameraFromDevice property alias deactivateCamera: camera.deactivateCamera readonly property alias isVideoEnabled: camera.isVideoEnabled + property alias cameraQmlName: camera.cameraQmlName property alias image: avatar.image property alias avatarBackgroundColor: avatar.avatarBackgroundColor diff --git a/linphone-app/ui/views/App/Calls/IncallActiveSpeaker.qml b/linphone-app/ui/views/App/Calls/IncallActiveSpeaker.qml index dc8fd5a24..85ac0ac1d 100644 --- a/linphone-app/ui/views/App/Calls/IncallActiveSpeaker.qml +++ b/linphone-app/ui/views/App/Calls/IncallActiveSpeaker.qml @@ -43,6 +43,7 @@ Item { anchors.fill: parent anchors.leftMargin: isRightReducedLayout || isLeftReducedLayout? 30 : 140 anchors.rightMargin: isRightReducedLayout ? 10 : 140 + cameraQmlName: 'AS' callModel: mainItem.callModel currentDevice: isPreview ? allDevices.me @@ -94,6 +95,7 @@ Item { sourceComponent: Sticker{ id: previewSticker + cameraQmlName: 'AS_Preview' deactivateCamera: !mainItem.cameraEnabled || !mainItem.callModel || callModel.pausedByUser || !mainItem.callModel.cameraEnabled currentDevice: allDevices.me isPreview: true @@ -166,6 +168,7 @@ Item { anchors.leftMargin: 3 anchors.rightMargin: 3 anchors.bottomMargin: 18 + cameraQmlName: 'S_'+index deactivateCamera: (!mainItem.isConferenceReady || !mainItem.isConference) && (index <0 || !mainItem.cameraEnabled || (!modelData.videoEnabled) || (callModel && callModel.pausedByUser) ) currentDevice: modelData.isPreview ? null : modelData diff --git a/linphone-app/ui/views/App/Calls/IncallGrid.qml b/linphone-app/ui/views/App/Calls/IncallGrid.qml index 56685c608..19ef63c5f 100644 --- a/linphone-app/ui/views/App/Calls/IncallGrid.qml +++ b/linphone-app/ui/views/App/Calls/IncallGrid.qml @@ -48,6 +48,7 @@ Mosaic { id: cameraView anchors.fill: parent + cameraQmlName: 'G_'+index callModel: index >= 0 ? participantDevices.callModel : null // do this before to prioritize changing call on remove deactivateCamera: index <0 || !grid.cameraEnabled || grid.callModel.pausedByUser currentDevice: gridModel.participantDevices.getAt(index) diff --git a/linphone-app/ui/views/App/Calls/WaitingRoom.qml b/linphone-app/ui/views/App/Calls/WaitingRoom.qml index eafe22ec0..3b9b342cd 100644 --- a/linphone-app/ui/views/App/Calls/WaitingRoom.qml +++ b/linphone-app/ui/views/App/Calls/WaitingRoom.qml @@ -150,6 +150,7 @@ Rectangle { anchors.centerIn: parent height: cameraHeight width : cameraWidth + cameraQmlName: 'WaitingRoom' callModel: mainItem.callModel conferenceInfoModel: mainItem.conferenceInfoModel ? mainItem.conferenceInfoModel diff --git a/linphone-app/ui/views/App/Main/Assistant/FetchRemoteConfiguration.qml b/linphone-app/ui/views/App/Main/Assistant/FetchRemoteConfiguration.qml index 319e19139..c671d1c9a 100644 --- a/linphone-app/ui/views/App/Main/Assistant/FetchRemoteConfiguration.qml +++ b/linphone-app/ui/views/App/Main/Assistant/FetchRemoteConfiguration.qml @@ -255,6 +255,7 @@ Item{ Layout.fillHeight: true Layout.preferredWidth: height Layout.alignment: Qt.AlignCenter + cameraQmlName: 'QRCode' showUsername: false showCustomButton: false visible: allQRCodeOptionsView.visible && assistantModel.isReadingQRCode diff --git a/linphone-app/ui/views/App/Main/Recordings.qml b/linphone-app/ui/views/App/Main/Recordings.qml index 749d91463..9d7e66792 100644 --- a/linphone-app/ui/views/App/Main/Recordings.qml +++ b/linphone-app/ui/views/App/Main/Recordings.qml @@ -263,6 +263,7 @@ Item { active: linphonePlayer sourceComponent: Component{ CameraView{ + qmlName: 'RecordingItem' isPreview: false linphonePlayer: videoView.linphonePlayer } diff --git a/linphone-app/ui/views/App/Settings/Dialogs/SettingsVideoPreview.qml b/linphone-app/ui/views/App/Settings/Dialogs/SettingsVideoPreview.qml index f9121d593..c728d2686 100644 --- a/linphone-app/ui/views/App/Settings/Dialogs/SettingsVideoPreview.qml +++ b/linphone-app/ui/views/App/Settings/Dialogs/SettingsVideoPreview.qml @@ -33,6 +33,7 @@ DialogPlus { anchors.centerIn: parent height: parent.height width: height + qmlName: 'SettingsVideo' showCloseButton: false } }