Fix call statistics displays and preview synchronization.

Fix video crashes.
This commit is contained in:
Julien Wadel 2022-04-26 16:08:10 +02:00
parent da7bd4464a
commit 7f8293f6cd
13 changed files with 72 additions and 39 deletions

View file

@ -96,7 +96,7 @@ job-macosx-makefile-package:
- $PACKAGE_MACOSX
- $DEPLOY_MACOSX
variables:
CMAKE_OPTIONS: -DENABLE_APP_PACKAGING=YES -DENABLE_G729=ON -DLINPHONE_SDK_MAKE_RELEASE_FILE_URL=$MAKE_RELEASE_FILE_URL/$MACOS_PLATFORM/$APP_FOLDER
CMAKE_OPTIONS: -DENABLE_APP_PACKAGING=YES -DENABLE_G729=ON -DLINPHONE_SDK_MAKE_RELEASE_FILE_URL=$MAKE_RELEASE_FILE_URL/$MACOSX_PLATFORM/$APP_FOLDER
extends: job-macosx-makefile
script:
- *build_all_script

View file

@ -62,6 +62,8 @@ Camera::Camera (QQuickItem *parent) : QQuickFramebufferObject(parent) {
Camera::~Camera(){
if(mIsPreview)
deactivatePreview();
// else
// resetWindowId();
}
void Camera::resetWindowId() {
@ -69,9 +71,10 @@ void Camera::resetWindowId() {
CoreManager::getInstance()->getCore()->setNativePreviewWindowId(NULL);
else if( mCallModel && mCallModel->getCall())
mCallModel->getCall()->setNativeVideoWindowId(NULL);
else if(mParticipantDeviceModel)
mParticipantDeviceModel->getDevice()->setNativeVideoWindowId(NULL);
else
else if(mParticipantDeviceModel){
if(mParticipantDeviceModel->getDevice())
mParticipantDeviceModel->getDevice()->setNativeVideoWindowId(NULL);
}else
CoreManager::getInstance()->getCore()->setNativeVideoWindowId(NULL);
}

View file

@ -128,7 +128,7 @@ bool ParticipantDeviceListModel::add(std::shared_ptr<linphone::ParticipantDevice
auto deviceModel = item.objectCast<ParticipantDeviceModel>();
if(deviceModel->getDevice() == deviceToAdd) {
qWarning() << "Device already exist. Send video update event";
emit deviceModel->videoEnabledChanged();
deviceModel->updateVideoEnabled();
return false;
}
}
@ -142,8 +142,10 @@ bool ParticipantDeviceListModel::add(std::shared_ptr<linphone::ParticipantDevice
bool ParticipantDeviceListModel::remove(std::shared_ptr<const linphone::ParticipantDevice> deviceToRemove){
int row = 0;
for(auto device : mList){
if( device.objectCast<ParticipantDeviceModel>()->getDevice() == deviceToRemove){
for(auto item : mList){
auto device = item.objectCast<ParticipantDeviceModel>();
if( device->getDevice() == deviceToRemove){
device->setIsLeft(true);
removeRow(row);
return true;
}else
@ -292,6 +294,7 @@ void ParticipantDeviceListModel::onParticipantDeviceMediaCapabilityChanged(const
device->updateVideoEnabled();
else
onParticipantDeviceAdded(participantDevice);
device = get(participantDevice);
if( device && device->isMe()){ // Capability change for me. Update all videos.
for(auto item : mList) {

View file

@ -146,11 +146,11 @@ void ParticipantDeviceModel::setIsSpeaking(bool speaking){
}
void ParticipantDeviceModel::updateVideoEnabled(){
bool enabled = mParticipantDevice && mParticipantDevice->getStreamAvailability(linphone::StreamType::Video) &&
bool enabled = !mIsLeft && (mParticipantDevice && mParticipantDevice->getStreamAvailability(linphone::StreamType::Video) &&
( mParticipantDevice->getStreamCapability(linphone::StreamType::Video) == linphone::MediaDirection::SendRecv
|| mParticipantDevice->getStreamCapability(linphone::StreamType::Video) == linphone::MediaDirection::SendOnly
)
|| isMe();
|| isMe());
if( mIsVideoEnabled != enabled && mCall && mCall->getCall()->getState() == linphone::Call::State::StreamsRunning) {
qWarning() << "VideoEnabled: " << enabled << ", old=" << mIsVideoEnabled << (mParticipantDevice ? mParticipantDevice->getAddress()->asString().c_str() : "") << ", me=" << isMe() << ", CallState=" << (mCall ? (int)mCall->getCall()->getState() : -1);
mIsVideoEnabled = enabled;
@ -158,6 +158,11 @@ void ParticipantDeviceModel::updateVideoEnabled(){
}
}
void ParticipantDeviceModel::setIsLeft(bool left) {
mIsLeft = left;
updateVideoEnabled();
}
bool ParticipantDeviceModel::isMe() const{
return mIsMe;
}

View file

@ -81,6 +81,7 @@ public:
void connectTo(ParticipantDeviceListener * listener);
void updateVideoEnabled();
void setIsLeft(bool left);
public slots:
void onSecurityLevelChanged(std::shared_ptr<const linphone::Address> device);
@ -98,6 +99,7 @@ private:
bool mIsVideoEnabled;
bool mIsPaused = false;
bool mIsSpeaking = false;
bool mIsLeft = false;
std::shared_ptr<linphone::ParticipantDevice> mParticipantDevice;
std::shared_ptr<ParticipantDeviceListener> mParticipantDeviceListener; // This is passed to linpĥone object and must be in shared_ptr

View file

@ -8,7 +8,7 @@ import Utils 1.0
Item {
id: wrapper
// Optionnal parameters, set the position of popup relative to this item.
property var relativeTo
property int relativeX: 0
@ -70,8 +70,8 @@ Item {
Controls.Popup {
id: popup
height: wrapper._content.height
width: wrapper._content.width
height: wrapper.height
width: wrapper.width
background: Rectangle {
color: PopupStyle.backgroundColor

View file

@ -11,14 +11,12 @@ Popup {
id: callStatistics
property var call
// ---------------------------------------------------------------------------
Rectangle {
color: CallStatisticsStyle.color
height: CallStatisticsStyle.height
height: callStatistics.height
width: callStatistics.width
Row {
anchors {
fill: parent

View file

@ -22,7 +22,7 @@ Item {
property bool hideCamera: false //callModel.pausedByUser
property bool isPaused: false
property bool isVideoEnabled: !container.currentDevice || (container.currentDevice && container.currentDevice.videoEnabled)
property bool isVideoEnabled: enabled && (!container.currentDevice || (container.currentDevice && container.currentDevice.videoEnabled))
function resetActive(){
resetTimer.resetActive()
@ -49,7 +49,7 @@ Item {
anchors.fill: parent
active: !resetActive && container.isVideoEnabled //avatarCell.currentDevice && (avatarCell.currentDevice.videoEnabled && !conference._fullscreen)
active: container.enabled && !resetActive && container.isVideoEnabled //avatarCell.currentDevice && (avatarCell.currentDevice.videoEnabled && !conference._fullscreen)
sourceComponent: container.isVideoEnabled && !container.isPaused? camera : null
Timer{
@ -75,8 +75,8 @@ Item {
isPreview: container.isPreview
onRequestNewRenderer: {resetTimer.resetActive()}
Component.onDestruction: {resetWindowId()}
Component.onCompleted: console.log("Completed Camera")
Component.onDestruction: {resetWindowId(); console.log("Destroyed Camera [" + isPreview + "] : " + camera)}
Component.onCompleted: console.log("Completed Camera [" + isPreview + "] : " + camera)
}
}

View file

@ -13,6 +13,7 @@ Item{
property alias currentDevice: camera.currentDevice
property alias hideCamera: camera.hideCamera
property alias isPaused: camera.isPaused
property alias isPreview: camera.isPreview
property bool showCloseButton: true
property color color : CameraViewStyle.backgroundColor
signal closeRequested()

View file

@ -108,6 +108,7 @@ Rectangle {
call: incall.call
width: container.width
height: container.height
relativeTo: callQuality
relativeY: CallStyle.header.stats.relativeY

View file

@ -26,7 +26,7 @@ Rectangle {
property ConferenceModel conferenceModel: callModel && callModel.getConferenceModel()
property var _fullscreen: null
property bool listCallsOpened: true
signal openListCallsRequest()
// ---------------------------------------------------------------------------
@ -224,15 +224,23 @@ Rectangle {
delegate: Item{
id: avatarCell
property ParticipantDeviceModel currentDevice: gridModel.participantDevices.getAt(index)
onCurrentDeviceChanged: console.log("currentDevice changed: " +currentDevice + (currentDevice?", me:"+currentDevice.isMe:'')+" ["+index+"]")
onCurrentDeviceChanged: {
console.log("currentDevice changed: " +currentDevice+"/"+cameraView.currentDevice + (currentDevice?", me:"+currentDevice.isMe:'')+" ["+index+"]")
if(index < 0) cameraView.enabled = false // this is a delegate destruction. We need to stop camera before Qt change its currentDevice (and then, let CameraView to delete wrong renderer)
}
//color: 'black' /*!conference.callModel && gridModel.defaultList.get(index).color ? gridModel.defaultList.get(index).color : */
//color: gridModel.model.get(index) && gridModel.model.get(index).color ? gridModel.model.get(index).color : '' // modelIndex is a custom index because by Mosaic modelisation, it is not accessible.
//color: $modelData.color ? $modelData.color : ''
height: grid.cellHeight - 10
width: grid.cellWidth - 10
Component.onCompleted: console.log("Completed: ["+index+"] " +(currentDevice?currentDevice.peerAddress+", isMe:"+currentDevice.isMe : '') )
Component.onCompleted: {
console.log("Completed: ["+index+"] " +(currentDevice?currentDevice.peerAddress+", isMe:"+currentDevice.isMe : '') )
}
CameraView{
id: cameraView
enabled: index >=0
anchors.fill: parent
currentDevice: avatarCell.currentDevice
isPaused: callModel.pausedByUser || avatarCell.currentDevice && avatarCell.currentDevice.isPaused //callModel.pausedByUser
@ -375,7 +383,7 @@ Rectangle {
colorSet: VideoConferenceStyle.buttons.callQuality
percentageDisplayed: 0
onClicked: {console.log("opening stats");Logic.openCallStatistics();console.log("Stats should be opened")}
onClicked: {Logic.openCallStatistics();}
Timer {
interval: 500
repeat: true
@ -390,17 +398,6 @@ Rectangle {
callQuality.percentageDisplayed = 0
}
}
CallStatistics {
id: callStatistics
call: callModel
width: conference.width
relativeTo: keypadButton
relativeY: CallStyle.header.stats.relativeY
onClosed: Logic.handleCallStatisticsClosed()
onOpened: console.log("Stats Opened: " +call+", " +width +", "+relativeY)
}
}
ActionButton{
isCustom: true
@ -413,7 +410,17 @@ Rectangle {
// ---------------------------------------------------------------------------
// TelKeypad.
// ---------------------------------------------------------------------------
CallStatistics {
id: callStatistics
call: conference.callModel
width: conference.width - 20
height: conference.height * 2/3
relativeTo: conference
relativeY: CallStyle.header.stats.relativeY
relativeX: 10
onClosed: Logic.handleCallStatisticsClosed()
}
TelKeypad {
id: telKeypad

View file

@ -17,6 +17,12 @@ Rectangle {
signal cancel()
function close(){
loader.active = false
}
function open(){
}
ColumnLayout {
anchors.fill: parent
Text{
@ -28,9 +34,12 @@ Rectangle {
font.pointSize: WaitingRoomStyle.title.pointSize
horizontalAlignment: Qt.AlignCenter
}
Item{
Loader{
id: loader
Layout.fillWidth: true
Layout.fillHeight: true
sourceComponent: Component{
CameraView{
id: previewLoader
showCloseButton: false
@ -39,6 +48,7 @@ Rectangle {
width : height
}
}
}
// -------------------------------------------------------------------------
// Action Buttons.
// -------------------------------------------------------------------------
@ -105,12 +115,15 @@ Rectangle {
TextButtonA {
text: 'CANCEL'
onClicked: mainItem.cancel()
onClicked: {
mainItem.close()
mainItem.cancel()
}
}
TextButtonB {
text: 'DEMARRER'
onClicked: CallsListModel.launchVideoCall(conferenceInfoModel.uri, '', 0, {video: camera.cameraEnabled, micro:!micro.microMuted, audio:!speaker.speakerMuted})
onClicked: {mainItem.close(); CallsListModel.launchVideoCall(conferenceInfoModel.uri, '', 0, {video: camera.cameraEnabled, micro:!micro.microMuted, audio:!speaker.speakerMuted}) }
}
}

@ -1 +1 @@
Subproject commit 809b278c08b43c821205d4f4ef4c86b2de49d393
Subproject commit b4d326a67d890048f6e869027350ea6ffb8cf8cb