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
1702e77a
Commit
1702e77a
authored
Apr 09, 2014
by
David Fuhrmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auhal: use audio device latency for better a/v synchronization and airplay support
refs #7127
parent
591efc80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
modules/audio_output/auhal.c
modules/audio_output/auhal.c
+20
-1
No files found.
modules/audio_output/auhal.c
View file @
1702e77a
...
@@ -117,6 +117,8 @@ struct aout_sys_t
...
@@ -117,6 +117,8 @@ struct aout_sys_t
vlc_cond_t
cond
;
vlc_cond_t
cond
;
bool
b_ignore_streams_changed_callback
;
bool
b_ignore_streams_changed_callback
;
UInt32
i_device_latency
;
/* The time the device needs to process the data. In samples. */
};
};
#pragma mark -
#pragma mark -
...
@@ -314,6 +316,7 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
...
@@ -314,6 +316,7 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
p_sys
->
b_changed_mixing
=
false
;
p_sys
->
b_changed_mixing
=
false
;
p_sys
->
i_bytes_per_sample
=
0
;
p_sys
->
i_bytes_per_sample
=
0
;
p_sys
->
b_paused
=
false
;
p_sys
->
b_paused
=
false
;
p_sys
->
i_device_latency
=
0
;
vlc_mutex_lock
(
&
p_sys
->
var_lock
);
vlc_mutex_lock
(
&
p_sys
->
var_lock
);
p_sys
->
i_selected_dev
=
p_sys
->
i_new_selected_dev
;
p_sys
->
i_selected_dev
=
p_sys
->
i_new_selected_dev
;
...
@@ -409,6 +412,22 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
...
@@ -409,6 +412,22 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
goto
error
;
goto
error
;
}
}
/* get device latency */
AudioObjectPropertyAddress
latencyAddress
=
{
kAudioDevicePropertyLatency
,
kAudioDevicePropertyScopeOutput
,
kAudioObjectPropertyElementMaster
};
i_param_size
=
sizeof
(
p_sys
->
i_device_latency
);
err
=
AudioObjectGetPropertyData
(
p_sys
->
i_selected_dev
,
&
latencyAddress
,
0
,
NULL
,
&
i_param_size
,
&
p_sys
->
i_device_latency
);
if
(
err
!=
noErr
)
{
msg_Warn
(
p_aout
,
"Cannot get device latency [%4.4s]"
,
(
char
*
)
&
err
);
}
msg_Dbg
(
p_aout
,
"Current device has a latency of %u frames"
,
p_sys
->
i_device_latency
);
bool
b_success
=
false
;
bool
b_success
=
false
;
/* Check for Digital mode or Analog output mode */
/* Check for Digital mode or Analog output mode */
...
@@ -1424,7 +1443,7 @@ static int TimeGet(audio_output_t *p_aout, mtime_t *delay)
...
@@ -1424,7 +1443,7 @@ static int TimeGet(audio_output_t *p_aout, mtime_t *delay)
int32_t
availableBytes
;
int32_t
availableBytes
;
TPCircularBufferTail
(
&
p_sys
->
circular_buffer
,
&
availableBytes
);
TPCircularBufferTail
(
&
p_sys
->
circular_buffer
,
&
availableBytes
);
*
delay
=
(
availableBytes
/
p_sys
->
i_bytes_per_sample
)
*
CLOCK_FREQ
/
p_sys
->
i_rate
;
*
delay
=
(
(
availableBytes
/
p_sys
->
i_bytes_per_sample
)
+
p_sys
->
i_device_latency
)
*
CLOCK_FREQ
/
p_sys
->
i_rate
;
return
0
;
return
0
;
}
}
...
...
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