mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Improved video activation while in audio only conference
This commit is contained in:
parent
aedd1a2577
commit
c7b4c14d66
2 changed files with 50 additions and 37 deletions
|
|
@ -203,50 +203,55 @@ class ConferenceModel {
|
|||
@UiThread
|
||||
fun changeLayout(newLayout: Int) {
|
||||
coreContext.postOnCoreThread {
|
||||
val call = conference.call
|
||||
if (call != null) {
|
||||
val params = call.core.createCallParams(call)
|
||||
if (params != null) {
|
||||
val currentLayout = getCurrentLayout(call)
|
||||
if (currentLayout != newLayout) {
|
||||
when (newLayout) {
|
||||
AUDIO_ONLY_LAYOUT -> {
|
||||
Log.i("$TAG Changing conference layout to [Audio Only]")
|
||||
params.isVideoEnabled = false
|
||||
}
|
||||
ACTIVE_SPEAKER_LAYOUT -> {
|
||||
Log.i("$TAG Changing conference layout to [Active Speaker]")
|
||||
params.conferenceVideoLayout = Conference.Layout.ActiveSpeaker
|
||||
}
|
||||
GRID_LAYOUT -> {
|
||||
Log.i("$TAG Changing conference layout to [Grid]")
|
||||
params.conferenceVideoLayout = Conference.Layout.Grid
|
||||
}
|
||||
}
|
||||
setNewLayout(newLayout)
|
||||
}
|
||||
}
|
||||
|
||||
if (currentLayout == AUDIO_ONLY_LAYOUT) {
|
||||
// Previous layout was audio only, make sure video isn't sent without user consent when switching layout
|
||||
Log.i(
|
||||
"$TAG Previous layout was [Audio Only], enabling video but in receive only direction"
|
||||
)
|
||||
params.isVideoEnabled = true
|
||||
params.videoDirection = MediaDirection.RecvOnly
|
||||
@WorkerThread
|
||||
fun setNewLayout(newLayout: Int) {
|
||||
val call = conference.call
|
||||
if (call != null) {
|
||||
val params = call.core.createCallParams(call)
|
||||
if (params != null) {
|
||||
val currentLayout = getCurrentLayout(call)
|
||||
if (currentLayout != newLayout) {
|
||||
when (newLayout) {
|
||||
AUDIO_ONLY_LAYOUT -> {
|
||||
Log.i("$TAG Changing conference layout to [Audio Only]")
|
||||
params.isVideoEnabled = false
|
||||
}
|
||||
ACTIVE_SPEAKER_LAYOUT -> {
|
||||
Log.i("$TAG Changing conference layout to [Active Speaker]")
|
||||
params.conferenceVideoLayout = Conference.Layout.ActiveSpeaker
|
||||
}
|
||||
GRID_LAYOUT -> {
|
||||
Log.i("$TAG Changing conference layout to [Grid]")
|
||||
params.conferenceVideoLayout = Conference.Layout.Grid
|
||||
}
|
||||
|
||||
Log.i("$TAG Updating conference's call params")
|
||||
call.update(params)
|
||||
conferenceLayout.postValue(newLayout)
|
||||
} else {
|
||||
Log.w(
|
||||
"$TAG The conference is already using selected layout, aborting layout change"
|
||||
)
|
||||
}
|
||||
|
||||
if (currentLayout == AUDIO_ONLY_LAYOUT) {
|
||||
// Previous layout was audio only, make sure video isn't sent without user consent when switching layout
|
||||
Log.i(
|
||||
"$TAG Previous layout was [Audio Only], enabling video but in receive only direction"
|
||||
)
|
||||
params.isVideoEnabled = true
|
||||
params.videoDirection = MediaDirection.RecvOnly
|
||||
}
|
||||
|
||||
Log.i("$TAG Updating conference's call params")
|
||||
call.update(params)
|
||||
conferenceLayout.postValue(newLayout)
|
||||
} else {
|
||||
Log.e("$TAG Failed to create call params, aborting layout change")
|
||||
Log.w(
|
||||
"$TAG The conference is already using selected layout, aborting layout change"
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Log.e("$TAG Failed to get call from conference, aborting layout change")
|
||||
Log.e("$TAG Failed to create call params, aborting layout change")
|
||||
}
|
||||
} else {
|
||||
Log.e("$TAG Failed to get call from conference, aborting layout change")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -532,12 +532,20 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
|
|||
val params = core.createCallParams(currentCall)
|
||||
if (currentCall.conference != null) {
|
||||
if (params?.isVideoEnabled == false) {
|
||||
Log.i("$TAG Conference found and video disabled in params, enabling it")
|
||||
params.isVideoEnabled = true
|
||||
params.videoDirection = MediaDirection.SendRecv
|
||||
conferenceModel.setNewLayout(ConferenceModel.ACTIVE_SPEAKER_LAYOUT)
|
||||
} else {
|
||||
if (params?.videoDirection == MediaDirection.SendRecv || params?.videoDirection == MediaDirection.SendOnly) {
|
||||
Log.i(
|
||||
"$TAG Conference found with video already enabled, changing video media direction to receive only"
|
||||
)
|
||||
params.videoDirection = MediaDirection.RecvOnly
|
||||
} else {
|
||||
Log.i(
|
||||
"$TAG Conference found with video already enabled, changing video media direction to send & receive"
|
||||
)
|
||||
params?.videoDirection = MediaDirection.SendRecv
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue