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
3012f5e2
Commit
3012f5e2
authored
Jul 25, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: avoid broken libasound channels remapping (fix #5122)
parent
63b35780
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
modules/audio_output/alsa.c
modules/audio_output/alsa.c
+14
-5
No files found.
modules/audio_output/alsa.c
View file @
3012f5e2
...
@@ -136,6 +136,8 @@ vlc_module_end ()
...
@@ -136,6 +136,8 @@ vlc_module_end ()
/* VLC will insert a resampling filter in any case, so it is best to turn off
/* VLC will insert a resampling filter in any case, so it is best to turn off
* ALSA (plug) resampling. */
* ALSA (plug) resampling. */
static
const
int
mode
=
SND_PCM_NO_AUTO_RESAMPLE
static
const
int
mode
=
SND_PCM_NO_AUTO_RESAMPLE
/* ALSA just discards extra channels. Not good. Disable it. */
|
SND_PCM_NO_AUTO_CHANNELS
/* VLC is currently unable to leverage ALSA softvol. Disable it. */
/* VLC is currently unable to leverage ALSA softvol. Disable it. */
|
SND_PCM_NO_SOFTVOL
;
|
SND_PCM_NO_SOFTVOL
;
...
@@ -340,14 +342,14 @@ static int Open (vlc_object_t *obj)
...
@@ -340,14 +342,14 @@ static int Open (vlc_object_t *obj)
snd_pcm_uframes_t
i_buffer_size
;
snd_pcm_uframes_t
i_buffer_size
;
snd_pcm_uframes_t
i_period_size
;
snd_pcm_uframes_t
i_period_size
;
int
i_
channels
;
unsigned
channels
;
if
(
spdif
)
if
(
spdif
)
{
{
fourcc
=
VLC_CODEC_SPDIFL
;
fourcc
=
VLC_CODEC_SPDIFL
;
i_buffer_size
=
ALSA_SPDIF_BUFFER_SIZE
;
i_buffer_size
=
ALSA_SPDIF_BUFFER_SIZE
;
pcm_format
=
SND_PCM_FORMAT_S16
;
pcm_format
=
SND_PCM_FORMAT_S16
;
i_
channels
=
2
;
channels
=
2
;
p_aout
->
i_nb_samples
=
i_period_size
=
ALSA_SPDIF_PERIOD_SIZE
;
p_aout
->
i_nb_samples
=
i_period_size
=
ALSA_SPDIF_PERIOD_SIZE
;
p_aout
->
format
.
i_bytes_per_frame
=
AOUT_SPDIF_SIZE
;
p_aout
->
format
.
i_bytes_per_frame
=
AOUT_SPDIF_SIZE
;
...
@@ -358,7 +360,7 @@ static int Open (vlc_object_t *obj)
...
@@ -358,7 +360,7 @@ static int Open (vlc_object_t *obj)
else
else
{
{
i_buffer_size
=
ALSA_DEFAULT_BUFFER_SIZE
;
i_buffer_size
=
ALSA_DEFAULT_BUFFER_SIZE
;
i_
channels
=
aout_FormatNbChannels
(
&
p_aout
->
format
);
channels
=
aout_FormatNbChannels
(
&
p_aout
->
format
);
p_aout
->
i_nb_samples
=
i_period_size
=
ALSA_DEFAULT_PERIOD_SIZE
;
p_aout
->
i_nb_samples
=
i_period_size
=
ALSA_DEFAULT_PERIOD_SIZE
;
...
@@ -401,8 +403,13 @@ static int Open (vlc_object_t *obj)
...
@@ -401,8 +403,13 @@ static int Open (vlc_object_t *obj)
}
}
/* Set channels. */
/* Set channels. */
val
=
snd_pcm_hw_params_set_channels
(
p_sys
->
p_snd_pcm
,
p_hw
,
i_channels
);
val
=
snd_pcm_hw_params_set_channels
(
p_sys
->
p_snd_pcm
,
p_hw
,
channels
);
if
(
val
<
0
)
if
(
val
<
0
&&
channels
>
2
)
/* Fallback to stereo */
{
val
=
snd_pcm_hw_params_set_channels
(
p_sys
->
p_snd_pcm
,
p_hw
,
2
);
channels
=
2
;
}
if
(
val
<
0
)
{
{
msg_Err
(
p_aout
,
"unable to set number of output channels (%s)"
,
msg_Err
(
p_aout
,
"unable to set number of output channels (%s)"
,
snd_strerror
(
val
)
);
snd_strerror
(
val
)
);
...
@@ -506,6 +513,8 @@ static int Open (vlc_object_t *obj)
...
@@ -506,6 +513,8 @@ static int Open (vlc_object_t *obj)
p_aout
->
format
.
i_format
=
fourcc
;
p_aout
->
format
.
i_format
=
fourcc
;
p_aout
->
format
.
i_rate
=
rate
;
p_aout
->
format
.
i_rate
=
rate
;
if
(
channels
==
2
)
p_aout
->
format
.
i_physical_channels
=
AOUT_CHAN_LEFT
|
AOUT_CHAN_RIGHT
;
Probe
(
obj
);
Probe
(
obj
);
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