Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
524413cf
Commit
524413cf
authored
Sep 09, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Factor async_reader waits using async_reader_get_wait_timeout.
parent
0ae64636
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
22 deletions
+25
-22
wm_asyncreader.c
dlls/winegstreamer/wm_asyncreader.c
+25
-22
No files found.
dlls/winegstreamer/wm_asyncreader.c
View file @
524413cf
...
...
@@ -82,6 +82,20 @@ static REFERENCE_TIME get_current_time(const struct async_reader *reader)
return
(
time
.
QuadPart
*
1000
)
/
reader
->
clock_frequency
.
QuadPart
*
10000
;
}
static
DWORD
async_reader_get_wait_timeout
(
struct
async_reader
*
reader
,
QWORD
pts
)
{
REFERENCE_TIME
current_time
=
reader
->
user_time
;
DWORD
timeout
=
INFINITE
;
if
(
!
reader
->
user_clock
)
{
current_time
=
get_current_time
(
reader
)
-
reader
->
clock_start
;
timeout
=
(
pts
-
current_time
)
/
10000
;
}
return
pts
>
current_time
?
timeout
:
0
;
}
static
void
callback_thread_run
(
struct
async_reader
*
reader
)
{
IWMReaderCallbackAdvanced
*
callback_advanced
=
reader
->
callback_advanced
;
...
...
@@ -96,6 +110,8 @@ static void callback_thread_run(struct async_reader *reader)
while
(
reader
->
running
&&
list_empty
(
&
reader
->
async_ops
))
{
DWORD
timeout
;
LeaveCriticalSection
(
&
reader
->
callback_cs
);
hr
=
wm_reader_get_stream_sample
(
&
reader
->
reader
,
callback_advanced
,
0
,
&
sample
,
&
pts
,
&
duration
,
&
flags
,
&
stream_number
);
EnterCriticalSection
(
&
reader
->
callback_cs
);
...
...
@@ -104,32 +120,19 @@ static void callback_thread_run(struct async_reader *reader)
stream
=
wm_reader_get_stream_by_stream_number
(
&
reader
->
reader
,
stream_number
);
if
(
reader
->
user_clock
)
if
(
reader
->
user_clock
&&
pts
>
reader
->
user_time
&&
callback_advanced
)
{
QWORD
user_time
=
reader
->
user_time
;
if
(
pts
>
user_time
&&
callback_advanced
)
{
LeaveCriticalSection
(
&
reader
->
callback_cs
);
IWMReaderCallbackAdvanced_OnTime
(
callback_advanced
,
user_time
,
reader
->
context
);
EnterCriticalSection
(
&
reader
->
callback_cs
);
}
while
(
reader
->
running
&&
list_empty
(
&
reader
->
async_ops
)
&&
pts
>
reader
->
user_time
)
SleepConditionVariableCS
(
&
reader
->
callback_cv
,
&
reader
->
callback_cs
,
INFINITE
);
LeaveCriticalSection
(
&
reader
->
callback_cs
);
IWMReaderCallbackAdvanced_OnTime
(
callback_advanced
,
user_time
,
reader
->
context
);
EnterCriticalSection
(
&
reader
->
callback_cs
);
}
else
{
while
(
reader
->
running
&&
list_empty
(
&
reader
->
async_ops
))
{
REFERENCE_TIME
current_time
=
get_current_time
(
reader
)
-
reader
->
clock_start
;
if
(
pts
<=
current_time
)
break
;
SleepConditionVariableCS
(
&
reader
->
callback_cv
,
&
reader
->
callback_cs
,
(
pts
-
current_time
)
/
10000
);
}
while
(
reader
->
running
&&
list_empty
(
&
reader
->
async_ops
))
{
if
(
!
(
timeout
=
async_reader_get_wait_timeout
(
reader
,
pts
)))
break
;
SleepConditionVariableCS
(
&
reader
->
callback_cv
,
&
reader
->
callback_cs
,
timeout
);
}
if
(
reader
->
running
&&
list_empty
(
&
reader
->
async_ops
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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