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
a97f3aa7
Commit
a97f3aa7
authored
Jul 27, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PulseAudio: limit resampling to 1% variation at a time
1kHz is way too much for human perception.
parent
81906599
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
modules/audio_output/pulse.c
modules/audio_output/pulse.c
+7
-7
No files found.
modules/audio_output/pulse.c
View file @
a97f3aa7
...
...
@@ -260,27 +260,27 @@ static void stream_latency_cb(pa_stream *s, void *userdata)
/* Compute playback sample rate */
const
unsigned
inrate
=
aout
->
format
.
i_rate
;
int
limit
=
inrate
/
100
;
/* max varation per iteration */
#define ADJUST_FACTOR 4
#define ADJUST_MAX 1000
/* Hz (max rate variation per call) */
/* This is empirical. Feel free to define something smarter. */
int
adj
=
sys
->
rate
*
(
delta
+
change
)
/
(
CLOCK_FREQ
*
ADJUST_FACTOR
);
/* This avoids too fast rate variation. They sound ugly as hell and they
* make the algorithm unstable (e.g. oscillation around inrate). */
if
(
adj
>
+
ADJUST_MAX
)
adj
=
+
ADJUST_MAX
;
if
(
adj
<
-
ADJUST_MAX
)
adj
=
-
ADJUST_MAX
;
if
(
adj
>
+
limit
)
adj
=
+
limit
;
if
(
adj
<
-
limit
)
adj
=
-
limit
;
unsigned
outrate
=
sys
->
rate
-
adj
;
/* Favor native rate to avoid resampling (FIXME: really a good idea?) */
if
(
abs
(
outrate
-
inrate
)
<
(
inrate
>>
10
)
)
if
(
abs
(
outrate
-
inrate
)
<
limit
)
outrate
=
inrate
;
/* This keeps the effective rate within specified range
* (+/-AOUT_MAX_RESAMPLING% - see <vlc_aout.h>) of the nominal rate. */
const
int
limit
=
inrate
*
AOUT_MAX_RESAMPLING
/
100
;
limit
*=
AOUT_MAX_RESAMPLING
;
if
(
outrate
>
inrate
+
limit
)
outrate
=
inrate
+
limit
;
if
(
outrate
<
inrate
-
limit
)
...
...
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