Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
54b3ae83
Commit
54b3ae83
authored
Nov 16, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sndio: implement latency measurement as per spec (untested)
parent
89a3302c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
+22
-4
modules/audio_output/sndio.c
modules/audio_output/sndio.c
+22
-4
No files found.
modules/audio_output/sndio.c
View file @
54b3ae83
...
...
@@ -49,10 +49,14 @@ static void Pause (audio_output_t *, bool, mtime_t);
static
int
VolumeSet
(
audio_output_t
*
,
float
);
static
int
MuteSet
(
audio_output_t
*
,
bool
);
static
void
VolumeChanged
(
void
*
,
unsigned
);
static
void
PositionChanged
(
void
*
,
int
);
struct
aout_sys_t
{
struct
sio_hdl
*
hdl
;
unsigned
long
long
read_offset
;
unsigned
long
long
write_offset
;
unsigned
rate
;
unsigned
volume
;
bool
mute
;
};
...
...
@@ -121,6 +125,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
}
fmt
->
i_rate
=
par
.
rate
;
sys
->
rate
=
par
.
rate
;
/* Channel map */
unsigned
chans
;
...
...
@@ -165,6 +170,9 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
aout
->
mute_set
=
NULL
;
}
sys
->
read_offset
=
0
;
sys
->
write_offset
=
0
;
sio_onmove
(
sys
->
hdl
,
PositionChanged
,
aout
);
sio_start
(
sys
->
hdl
);
return
VLC_SUCCESS
;
...
...
@@ -181,15 +189,23 @@ static void Close (vlc_object_t *obj)
sio_close
(
sys
->
hdl
);
}
static
void
PositionChanged
(
void
*
arg
,
int
delta
)
{
audio_output_t
*
aout
=
arg
;
aout_sys_t
*
sys
=
aout
->
sys
;
sys
->
read_offset
+=
delta
;
}
static
int
TimeGet
(
audio_output_t
*
aout
,
mtime_t
*
restrict
pts
)
{
aout_sys_t
*
sys
=
aout
->
sys
;
struct
sio_par
par
;
long
long
frames
=
sys
->
write_offset
-
sys
->
read_offset
;
if
(
sio_getpar
(
sys
->
hdl
,
&
par
)
)
if
(
frames
==
0
)
return
-
1
;
*
pts
=
mdate
()
+
(
par
.
bufsz
*
CLOCK_FREQ
/
aout
->
format
.
i_
rate
);
*
pts
=
mdate
()
+
(
frames
*
CLOCK_FREQ
/
sys
->
rate
);
return
0
;
}
...
...
@@ -197,13 +213,15 @@ static void Play (audio_output_t *aout, block_t *block)
{
aout_sys_t
*
sys
=
aout
->
sys
;
sys
->
write_offset
+=
block
->
i_nb_samples
;
while
(
block
->
i_buffer
>
0
&&
!
sio_eof
(
sys
->
hdl
))
{
size_t
bytes
=
sio_write
(
sys
->
hdl
,
block
->
p_buffer
,
block
->
i_buffer
);
block
->
p_buffer
+=
bytes
;
block
->
i_buffer
-=
bytes
;
/* Note that i_nb_samples and i_pts are
corrup
ted here. */
/* Note that i_nb_samples and i_pts are
not upda
ted here. */
}
block_Release
(
block
);
}
...
...
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