Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jdk17u
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
einsteinathome
openjdk
jdk17u
Commits
3d39e853
Commit
3d39e853
authored
11 months ago
by
Matthias Baesken
Browse files
Options
Downloads
Patches
Plain Diff
8320655: awt screencast robot spin and sync issues with native libpipewire api
Backport-of: c17b8cfafe5a2bbe29d38cfc6793c72b0430f6ca
parent
73b24d05
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/java.desktop/unix/native/libawt_xawt/awt/screencast_pipewire.c
+30
-4
30 additions, 4 deletions
...desktop/unix/native/libawt_xawt/awt/screencast_pipewire.c
with
30 additions
and
4 deletions
src/java.desktop/unix/native/libawt_xawt/awt/screencast_pipewire.c
+
30
−
4
View file @
3d39e853
...
...
@@ -43,7 +43,8 @@ int DEBUG_SCREENCAST_ENABLED = FALSE;
(*env)->ExceptionDescribe(env); \
}
static
volatile
gboolean
sessionClosed
=
TRUE
;
static
gboolean
hasPipewireFailed
=
FALSE
;
static
gboolean
sessionClosed
=
TRUE
;
static
GString
*
activeSessionToken
;
struct
ScreenSpace
screenSpace
=
{
0
};
...
...
@@ -171,6 +172,7 @@ static gboolean initScreencast(const gchar *token,
}
gtk
->
g_string_printf
(
activeSessionToken
,
"%s"
,
token
);
hasPipewireFailed
=
FALSE
;
sessionClosed
=
FALSE
;
return
TRUE
;
}
...
...
@@ -338,6 +340,8 @@ static void onStreamProcess(void *userdata) {
DEBUG_SCREEN_PREFIX
(
screen
,
"data ready
\n
"
,
NULL
);
fp_pw_stream_queue_buffer
(
data
->
stream
,
pwBuffer
);
fp_pw_thread_loop_signal
(
pw
.
loop
,
FALSE
);
}
static
void
onStreamStateChanged
(
...
...
@@ -351,6 +355,12 @@ static void onStreamStateChanged(
old
,
fp_pw_stream_state_as_string
(
old
),
state
,
fp_pw_stream_state_as_string
(
state
),
error
);
if
(
state
==
PW_STREAM_STATE_ERROR
||
state
==
PW_STREAM_STATE_UNCONNECTED
)
{
hasPipewireFailed
=
TRUE
;
fp_pw_thread_loop_signal
(
pw
.
loop
,
FALSE
);
}
}
static
const
struct
pw_stream_events
streamEvents
=
{
...
...
@@ -473,6 +483,11 @@ static gboolean connectStream(int index) {
while
(
!
data
->
hasFormat
)
{
fp_pw_thread_loop_wait
(
pw
.
loop
);
fp_pw_thread_loop_accept
(
pw
.
loop
);
if
(
hasPipewireFailed
)
{
fp_pw_thread_loop_unlock
(
pw
.
loop
);
return
FALSE
;
}
}
DEBUG_SCREEN_PREFIX
(
data
->
screenProps
,
...
...
@@ -480,8 +495,6 @@ static gboolean connectStream(int index) {
data
->
rawFormat
.
size
.
width
,
data
->
rawFormat
.
size
.
height
);
fp_pw_thread_loop_accept
(
pw
.
loop
);
return
TRUE
;
}
...
...
@@ -539,8 +552,13 @@ static void onCoreError(
"!!! pipewire error: id %u, seq: %d, res: %d (%s): %s
\n
"
,
id
,
seq
,
res
,
strerror
(
res
),
message
);
if
(
id
==
PW_ID_CORE
)
{
fp_pw_thread_loop_lock
(
pw
.
loop
);
hasPipewireFailed
=
TRUE
;
fp_pw_thread_loop_signal
(
pw
.
loop
,
FALSE
);
fp_pw_thread_loop_unlock
(
pw
.
loop
);
}
}
static
const
struct
pw_core_events
coreEvents
=
{
PW_VERSION_CORE_EVENTS
,
...
...
@@ -904,7 +922,15 @@ JNIEXPORT jint JNICALL Java_sun_awt_screencast_ScreencastHelper_getRGBPixelsImpl
}
while
(
!
isAllDataReady
())
{
fp_pw_thread_loop_lock
(
pw
.
loop
);
fp_pw_thread_loop_wait
(
pw
.
loop
);
if
(
hasPipewireFailed
)
{
fp_pw_thread_loop_unlock
(
pw
.
loop
);
doCleanup
();
releaseToken
(
env
,
jtoken
,
token
);
return
RESULT_ERROR
;
}
fp_pw_thread_loop_unlock
(
pw
.
loop
);
}
DEBUG_SCREENCAST
(
"
\n
all data ready
\n
"
,
NULL
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment