Fix crash on starting multiple calls at the same time.

Fix blank screen when starting a new call after doing one.
This commit is contained in:
Julien Wadel 2023-06-09 14:58:02 +02:00
parent eafb33e6b8
commit 03c9a68068
3 changed files with 28 additions and 6 deletions

View file

@ -202,9 +202,13 @@ void CallsListModel::launchVideoCall (const QString &sipAddress, const QString&
CallModel::setRecordFile(params, Utils::coreStringToAppString(address->getUsername()));
auto call = core->inviteAddressWithParams(address, params);
call->setSpeakerMuted(!enableSpeaker);
qInfo() << "Launch " << (enableVideo ? "video" : "audio") << " call; camera: " << enableCamera<< " speaker:" << enableSpeaker << ", micro:" << params->micEnabled() << ", layout:" << (int)layout;
CallModel::prepareTransfert(call, prepareTransfertAddress);
if(!call)
qWarning() << "Cannot initiate call. Maybe another one is currently done: delay the call.";
else{
call->setSpeakerMuted(!enableSpeaker);
qInfo() << "Launch " << (enableVideo ? "video" : "audio") << " call; camera: " << enableCamera<< " speaker:" << enableSpeaker << ", micro:" << params->micEnabled() << ", layout:" << (int)layout;
CallModel::prepareTransfert(call, prepareTransfertAddress);
}
}
QVariantMap CallsListModel::launchChat(const QString &sipAddress, const int& securityLevel) const{

View file

@ -157,6 +157,7 @@ function getParams (call) {
}
function updateSelectedCall (call, index) {
console.debug('updateSelectedCall: '+call + ' / ' +index)
if(index != undefined){
calls._selectedCall = call ? call : null
if (index != null) {
@ -185,6 +186,7 @@ function setIndexWithCall (call) {
for (var i = 0; i < count; i++) {
if (call === model.data(model.index(i, 0))) {
console.debug('setIndexWithCall: '+call + ' / ' +i)
updateSelectedCall(call, i)
return
}
@ -212,16 +214,19 @@ function handleCountChanged (count) {
if(model){// Choose one call
var candidate = getCallToStatusCondition(model, Linphone.CallModel.CallStatusConnected)
if(candidate && candidate.callModel.isOutgoing) {
console.debug('handleCountChanged: '+candidate.callModel+ ' / ' +candidate.index)
updateSelectedCall(candidate.callModel, candidate.index)
return;
}
candidate = getCallToStatusCondition(model, Linphone.CallModel.CallStatusOutgoing)
if(candidate){
console.debug('handleCountChanged: '+candidate.callModel+ ' / ' +candidate.index)
updateSelectedCall(candidate.callModel, candidate.index)
return;
}
candidate = getCallToStatusCondition(model, Linphone.CallModel.CallStatusPaused)
if(candidate){
console.debug('handleCountChanged: '+candidate.callModel+ ' / ' +candidate.index)
updateSelectedCall(candidate.callModel, candidate.index)
return;
}else
@ -231,11 +236,13 @@ function handleCountChanged (count) {
if(model){// Select a call that has been localy initiated.
var candidate = getCallToStatusCondition(model, Linphone.CallModel.CallStatusConnected)
if(candidate && candidate.callModel.isOutgoing) {
console.debug('handleCountChanged: '+candidate.callModel+ ' / ' +candidate.index)
updateSelectedCall(candidate.callModel, candidate.index)
return;
}
candidate = getCallToStatusCondition(model, Linphone.CallModel.CallStatusOutgoing)
if(candidate){
console.debug('handleCountChanged: '+candidate.callModel+ ' / ' +candidate.index)
updateSelectedCall(candidate.callModel, candidate.index)
return;
}
@ -269,7 +276,8 @@ function handleRowsInserted (_, first, last) {
var call = model.data(model.index(index, 0))
if (call.isOutgoing && !call.isInConference) {
updateSelectedCall(call)
console.debug('handleRowsInserted: '+call+ ' / ' +index +' / ' +model.index(index, 0))
updateSelectedCall(call, index)
return
}
}
@ -278,7 +286,8 @@ function handleRowsInserted (_, first, last) {
if (first === 0 && model.rowCount() === 1) {
var call = model.data(model.index(0, 0))
if (!call.isInConference) {
updateSelectedCall(model.data(model.index(0, 0)))
console.debug('handleRowsInserted: '+model.data(model.index(0, 0))+ ' / 0 / ' +model.index(0, 0))
updateSelectedCall(model.data(model.index(0, 0)),0)
}
}
}

View file

@ -69,31 +69,40 @@ function openWaitingRoom(model){
function getContent (call, conferenceInfoModel) {
if (call == null) {
if(conferenceInfoModel) {
console.debug('New Content:' +waitingRoom)
return waitingRoom
}
else{
console.debug('New Content: null')
return null
}
}
var status = call.status
if (status == null) {
return calls.conferenceModel.count > 0 ? conference : null
var contentView = calls.conferenceModel.count > 0 ? conference : null
console.debug('New Content: ' +contentView)
return contentView
}
var CallModel = Linphone.CallModel
if (status === CallModel.CallStatusIncoming) {
console.debug('New Content: ' +incall)
return incall;
}
if( window.conferenceInfoModel != call.conferenceInfoModel) {
Qt.callLater(function(){window.conferenceInfoModel = call.conferenceInfoModel})
console.debug('New Content: ' +middlePane.sourceComponent)
return middlePane.sourceComponent // unchange. Wait for later decision on conference model (avoid binding loop on sourceComponent)
}else{
if(call.isConference){
console.debug('New Content: ' +incall)
return incall
}
if (status === CallModel.CallStatusOutgoing || (status === CallModel.CallStatusEnded && call.callError != '' )) {
console.debug('New Content: ' +waitingRoom)
return waitingRoom
}
console.debug('New Content: ' +incall)
return incall
}
}