Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
9577406b
Commit
9577406b
authored
Mar 01, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wasapi: fix TimeGet()
parent
83fbb464
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
22 deletions
+24
-22
modules/audio_output/wasapi.c
modules/audio_output/wasapi.c
+24
-22
No files found.
modules/audio_output/wasapi.c
View file @
9577406b
...
@@ -85,36 +85,38 @@ static HRESULT TimeGet(aout_stream_t *s, mtime_t *restrict delay)
...
@@ -85,36 +85,38 @@ static HRESULT TimeGet(aout_stream_t *s, mtime_t *restrict delay)
{
{
aout_stream_sys_t
*
sys
=
s
->
sys
;
aout_stream_sys_t
*
sys
=
s
->
sys
;
void
*
pv
;
void
*
pv
;
UINT64
pos
,
qpcpos
;
UINT64
pos
,
qpcpos
,
freq
;
HRESULT
hr
;
HRESULT
hr
;
hr
=
IAudioClient_GetService
(
sys
->
client
,
&
IID_IAudioClock
,
&
pv
);
hr
=
IAudioClient_GetService
(
sys
->
client
,
&
IID_IAudioClock
,
&
pv
);
if
(
SUCCEED
ED
(
hr
))
if
(
FAIL
ED
(
hr
))
{
{
IAudioClock
*
clock
=
pv
;
hr
=
IAudioClock_GetPosition
(
clock
,
&
pos
,
&
qpcpos
);
if
(
FAILED
(
hr
))
msg_Err
(
s
,
"cannot get position (error 0x%lx)"
,
hr
);
IAudioClock_Release
(
clock
);
}
else
msg_Err
(
s
,
"cannot get clock (error 0x%lx)"
,
hr
);
msg_Err
(
s
,
"cannot get clock (error 0x%lx)"
,
hr
);
return
hr
;
}
IAudioClock
*
clock
=
pv
;
hr
=
IAudioClock_GetPosition
(
clock
,
&
pos
,
&
qpcpos
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
hr
=
IAudioClock_GetFrequency
(
clock
,
&
freq
);
IAudioClock_Release
(
clock
);
if
(
FAILED
(
hr
))
{
{
if
(
pos
!=
0
)
msg_Err
(
s
,
"cannot get position (error 0x%lx)"
,
hr
);
{
return
hr
;
*
delay
=
((
GetQPC
()
-
qpcpos
)
/
(
10000000
/
CLOCK_FREQ
));
static_assert
((
10000000
%
CLOCK_FREQ
)
==
0
,
"Frequency conversion broken"
);
}
else
{
*
delay
=
sys
->
written
*
CLOCK_FREQ
/
sys
->
rate
;
msg_Dbg
(
s
,
"extrapolating position: still propagating buffers"
);
}
}
}
lldiv_t
w
=
lldiv
(
sys
->
written
,
sys
->
rate
);
lldiv_t
r
=
lldiv
(
pos
,
freq
);
static_assert
((
10000000
%
CLOCK_FREQ
)
==
0
,
"Frequency conversion broken"
);
*
delay
=
((
w
.
quot
-
r
.
quot
)
*
CLOCK_FREQ
)
+
((
w
.
rem
*
CLOCK_FREQ
)
/
sys
->
rate
)
-
((
r
.
rem
*
CLOCK_FREQ
)
/
freq
)
-
((
GetQPC
()
-
qpcpos
)
/
(
10000000
/
CLOCK_FREQ
));
return
hr
;
return
hr
;
}
}
...
@@ -407,7 +409,7 @@ static void Stop(aout_stream_t *s)
...
@@ -407,7 +409,7 @@ static void Stop(aout_stream_t *s)
vlc_module_begin
()
vlc_module_begin
()
set_shortname
(
"WASAPI"
)
set_shortname
(
"WASAPI"
)
set_description
(
N_
(
"Windows Audio Session API output"
))
set_description
(
N_
(
"Windows Audio Session API output"
))
set_capability
(
"aout stream"
,
/*50*/
0
)
set_capability
(
"aout stream"
,
5
0
)
set_category
(
CAT_AUDIO
)
set_category
(
CAT_AUDIO
)
set_subcategory
(
SUBCAT_AUDIO_AOUT
)
set_subcategory
(
SUBCAT_AUDIO_AOUT
)
set_callbacks
(
Start
,
Stop
)
set_callbacks
(
Start
,
Stop
)
...
...
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