Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-client-android
Commits
b3506346
Commit
b3506346
authored
Sep 24, 2021
by
Adrien Béraud
Browse files
video: synchronize surface access
Change-Id: Idb2520831ccbb40cdf1dfeb71b8f6318026a1206
parent
d0843097
Changes
1
Hide whitespace changes
Inline
Side-by-side
ring-android/app/src/main/java/cx/ring/services/HardwareServiceImpl.kt
View file @
b3506346
...
...
@@ -319,8 +319,8 @@ class HardwareServiceImpl(
bluetoothEvents
.
onNext
(
event
)
}
override
fun
decodingStarted
(
id
:
String
,
shmPath
:
String
,
width
:
Int
,
height
:
Int
,
isMixer
:
Boolean
)
{
Log
.
i
(
TAG
,
"
DEBUG
decodingStarted() "
+
id
+
" "
+
width
+
"x"
+
height
)
@Synchronized
override
fun
decodingStarted
(
id
:
String
,
shmPath
:
String
,
width
:
Int
,
height
:
Int
,
isMixer
:
Boolean
)
{
Log
.
i
(
TAG
,
"decodingStarted() "
+
id
+
" "
+
width
+
"x"
+
height
)
val
shm
=
Shm
(
id
,
width
,
height
)
videoInputs
[
id
]
=
shm
videoEvents
.
onNext
(
VideoEvent
(
id
,
start
=
true
))
...
...
@@ -334,8 +334,8 @@ class HardwareServiceImpl(
}
}
override
fun
decodingStopped
(
id
:
String
,
shmPath
:
String
,
isMixer
:
Boolean
)
{
Log
.
i
(
TAG
,
"
DEBUG
decodingStopped() $id"
)
@Synchronized
override
fun
decodingStopped
(
id
:
String
,
shmPath
:
String
,
isMixer
:
Boolean
)
{
Log
.
i
(
TAG
,
"decodingStopped() $id"
)
val
shm
=
videoInputs
.
remove
(
id
)
?:
return
if
(
shm
.
window
!=
0L
)
{
try
{
...
...
@@ -521,7 +521,7 @@ class HardwareServiceImpl(
mIsCapturing
=
false
}
override
fun
addVideoSurface
(
id
:
String
,
holder
:
Any
)
{
@Synchronized
override
fun
addVideoSurface
(
id
:
String
,
holder
:
Any
)
{
if
(
holder
!
is
SurfaceHolder
)
{
return
}
...
...
@@ -540,7 +540,7 @@ class HardwareServiceImpl(
}
}
override
fun
updateVideoSurfaceId
(
currentId
:
String
,
newId
:
String
)
{
@Synchronized
override
fun
updateVideoSurfaceId
(
currentId
:
String
,
newId
:
String
)
{
Log
.
w
(
TAG
,
"updateVideoSurfaceId $currentId $newId"
)
val
surfaceHolder
=
videoSurfaces
[
currentId
]
?:
return
val
surface
=
surfaceHolder
.
get
()
...
...
@@ -557,7 +557,7 @@ class HardwareServiceImpl(
surface
?.
let
{
addVideoSurface
(
newId
,
it
)
}
}
override
fun
addPreviewVideoSurface
(
holder
:
Any
,
conference
:
Conference
?)
{
@Synchronized
override
fun
addPreviewVideoSurface
(
holder
:
Any
,
conference
:
Conference
?)
{
if
(
holder
!
is
TextureView
)
return
Log
.
w
(
TAG
,
"addPreviewVideoSurface "
+
holder
.
hashCode
()
+
" mCapturingId "
+
mCapturingId
)
...
...
@@ -569,7 +569,7 @@ class HardwareServiceImpl(
}
}
override
fun
updatePreviewVideoSurface
(
conference
:
Conference
)
{
@Synchronized
override
fun
updatePreviewVideoSurface
(
conference
:
Conference
)
{
val
old
=
mCameraPreviewCall
.
get
()
mCameraPreviewCall
=
WeakReference
(
conference
)
if
(
old
!==
conference
&&
mIsCapturing
)
{
...
...
@@ -579,7 +579,7 @@ class HardwareServiceImpl(
}
}
override
fun
removeVideoSurface
(
id
:
String
)
{
@Synchronized
override
fun
removeVideoSurface
(
id
:
String
)
{
Log
.
i
(
TAG
,
"removeVideoSurface $id"
)
videoSurfaces
.
remove
(
id
)
val
shm
=
videoInputs
[
id
]
?:
return
...
...
@@ -652,6 +652,6 @@ class HardwareServiceImpl(
private
val
TAG
=
HardwareServiceImpl
::
class
.
simpleName
!!
private
var
mCameraPreviewSurface
=
WeakReference
<
TextureView
>(
null
)
private
var
mCameraPreviewCall
=
WeakReference
<
Conference
>(
null
)
private
val
videoSurfaces
=
Collections
.
synchronizedMap
(
HashMap
<
String
,
WeakReference
<
SurfaceHolder
>>()
)
private
val
videoSurfaces
=
HashMap
<
String
,
WeakReference
<
SurfaceHolder
>>()
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment