Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
c64775fd
Commit
c64775fd
authored
Jun 10, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Jun 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Move end conditions out of the wm_asyncreader stream loop.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
parent
4edad993
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
59 deletions
+56
-59
wm_asyncreader.c
dlls/winegstreamer/wm_asyncreader.c
+56
-59
No files found.
dlls/winegstreamer/wm_asyncreader.c
View file @
c64775fd
...
...
@@ -74,12 +74,13 @@ static DWORD WINAPI stream_thread(void *arg)
struct
async_reader
*
reader
=
arg
;
IWMReaderCallback
*
callback
=
reader
->
callback
;
REFERENCE_TIME
start_time
;
struct
wm_stream
*
stream
;
static
const
DWORD
zero
;
QWORD
pts
,
duration
;
WORD
stream_number
;
INSSBuffer
*
sample
;
HRESULT
hr
=
S_OK
;
DWORD
flags
;
HRESULT
hr
;
start_time
=
get_current_time
(
reader
);
...
...
@@ -88,80 +89,76 @@ static DWORD WINAPI stream_thread(void *arg)
while
(
reader
->
running
)
{
hr
=
wm_reader_get_stream_sample
(
&
reader
->
reader
,
0
,
&
sample
,
&
pts
,
&
duration
,
&
flags
,
&
stream_number
);
if
(
hr
!=
S_OK
)
break
;
stream
=
wm_reader_get_stream_by_stream_number
(
&
reader
->
reader
,
stream_number
);
if
(
hr
==
S_OK
)
if
(
reader
->
user_clock
)
{
struct
wm_stream
*
stream
=
wm_reader_get_stream_by_stream_number
(
&
reader
->
reader
,
stream_number
)
;
QWORD
user_time
=
reader
->
user_time
;
if
(
reader
->
user_clock
)
if
(
pts
>
user_time
&&
reader
->
reader
.
callback_advanced
)
IWMReaderCallbackAdvanced_OnTime
(
reader
->
reader
.
callback_advanced
,
user_time
,
reader
->
context
);
while
(
pts
>
reader
->
user_time
&&
reader
->
running
)
SleepConditionVariableCS
(
&
reader
->
stream_cv
,
&
reader
->
stream_cs
,
INFINITE
);
if
(
!
reader
->
running
)
{
QWORD
user_time
=
reader
->
user_time
;
if
(
pts
>
user_time
&&
reader
->
reader
.
callback_advanced
)
IWMReaderCallbackAdvanced_OnTime
(
reader
->
reader
.
callback_advanced
,
user_time
,
reader
->
context
);
while
(
pts
>
reader
->
user_time
&&
reader
->
running
)
SleepConditionVariableCS
(
&
reader
->
stream_cv
,
&
reader
->
stream_cs
,
INFINITE
);
if
(
!
reader
->
running
)
{
INSSBuffer_Release
(
sample
);
goto
out
;
}
INSSBuffer_Release
(
sample
);
goto
out
;
}
else
}
else
{
for
(;;)
{
for
(;;)
{
REFERENCE_TIME
current_time
=
get_current_time
(
reader
);
REFERENCE_TIME
current_time
=
get_current_time
(
reader
);
if
(
pts
<=
current_time
-
start_time
)
break
;
if
(
pts
<=
current_time
-
start_time
)
break
;
SleepConditionVariableCS
(
&
reader
->
stream_cv
,
&
reader
->
stream_cs
,
(
pts
-
(
current_time
-
start_time
))
/
10000
);
SleepConditionVariableCS
(
&
reader
->
stream_cv
,
&
reader
->
stream_cs
,
(
pts
-
(
current_time
-
start_time
))
/
10000
);
if
(
!
reader
->
running
)
{
INSSBuffer_Release
(
sample
);
goto
out
;
}
if
(
!
reader
->
running
)
{
INSSBuffer_Release
(
sample
);
goto
out
;
}
}
if
(
stream
->
read_compressed
)
hr
=
IWMReaderCallbackAdvanced_OnStreamSample
(
reader
->
reader
.
callback_advanced
,
stream_number
,
pts
,
duration
,
flags
,
sample
,
reader
->
context
);
else
hr
=
IWMReaderCallback_OnSample
(
callback
,
stream_number
-
1
,
pts
,
duration
,
flags
,
sample
,
reader
->
context
);
TRACE
(
"Callback returned %#lx.
\n
"
,
hr
);
INSSBuffer_Release
(
sample
);
}
else
if
(
hr
==
NS_E_NO_MORE_SAMPLES
)
{
IWMReaderCallback_OnStatus
(
callback
,
WMT_END_OF_STREAMING
,
S_OK
,
WMT_TYPE_DWORD
,
(
BYTE
*
)
&
zero
,
reader
->
context
);
IWMReaderCallback_OnStatus
(
callback
,
WMT_EOF
,
S_OK
,
WMT_TYPE_DWORD
,
(
BYTE
*
)
&
zero
,
reader
->
context
);
if
(
reader
->
user_clock
&&
reader
->
reader
.
callback_advanced
)
{
/* We can only get here if user_time is greater than the PTS
* of all samples, in which case we cannot have sent this
* notification already. */
IWMReaderCallbackAdvanced_OnTime
(
reader
->
reader
.
callback_advanced
,
reader
->
user_time
,
reader
->
context
);
}
TRACE
(
"Reached end of stream; exiting.
\n
"
);
LeaveCriticalSection
(
&
reader
->
stream_cs
);
return
0
;
}
if
(
stream
->
read_compressed
)
hr
=
IWMReaderCallbackAdvanced_OnStreamSample
(
reader
->
reader
.
callback_advanced
,
stream_number
,
pts
,
duration
,
flags
,
sample
,
reader
->
context
);
else
hr
=
IWMReaderCallback_OnSample
(
callback
,
stream_number
-
1
,
pts
,
duration
,
flags
,
sample
,
reader
->
context
);
TRACE
(
"Callback returned %#lx.
\n
"
,
hr
);
INSSBuffer_Release
(
sample
);
}
if
(
hr
==
NS_E_NO_MORE_SAMPLES
)
{
IWMReaderCallback_OnStatus
(
callback
,
WMT_END_OF_STREAMING
,
S_OK
,
WMT_TYPE_DWORD
,
(
BYTE
*
)
&
zero
,
reader
->
context
);
IWMReaderCallback_OnStatus
(
callback
,
WMT_EOF
,
S_OK
,
WMT_TYPE_DWORD
,
(
BYTE
*
)
&
zero
,
reader
->
context
);
if
(
reader
->
user_clock
&&
reader
->
reader
.
callback_advanced
)
{
ERR
(
"Failed to get sample, hr %#lx.
\n
"
,
hr
);
LeaveCriticalSection
(
&
reader
->
stream_cs
);
return
0
;
/* We can only get here if user_time is greater than the PTS
* of all samples, in which case we cannot have sent this
* notification already. */
IWMReaderCallbackAdvanced_OnTime
(
reader
->
reader
.
callback_advanced
,
reader
->
user_time
,
reader
->
context
);
}
TRACE
(
"Reached end of stream; exiting.
\n
"
);
}
else
if
(
hr
!=
S_OK
)
{
ERR
(
"Failed to get sample, hr %#lx.
\n
"
,
hr
);
}
out:
...
...
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