aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-11 07:50:20 +0200
committerMax Kellermann <max@duempel.org>2008-09-11 07:50:20 +0200
commit85d952c58b4d135e5096c099d1e2e94fe75328fa (patch)
tree251b7b45bfab11ba3cf914149a8ed1cabac195b5 /src
parent420c879dd65e1cafe3492f076f7f41bffd438b37 (diff)
downloadmpd-85d952c58b4d135e5096c099d1e2e94fe75328fa.tar.gz
mpd-85d952c58b4d135e5096c099d1e2e94fe75328fa.tar.xz
mpd-85d952c58b4d135e5096c099d1e2e94fe75328fa.zip
output: copy reqAudioFormat to outAudioFormat only if not yet open
If the output device is already open, it may have modified outAudioFormat; in this case, outAudioFormat is still valid, and does not need an overwrite.
Diffstat (limited to '')
-rw-r--r--src/output_control.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/output_control.c b/src/output_control.c
index 26558d3c4..0818a459b 100644
--- a/src/output_control.c
+++ b/src/output_control.c
@@ -34,7 +34,13 @@ int audio_output_open(struct audio_output *audioOutput,
audioOutput->inAudioFormat = *audioFormat;
if (audio_format_defined(&audioOutput->reqAudioFormat)) {
- audioOutput->outAudioFormat = audioOutput->reqAudioFormat;
+ /* copy reqAudioFormat to outAudioFormat only if the
+ device is not yet open; if it is already open,
+ plugin->open() may have modified outAudioFormat,
+ and the value is already ok */
+ if (!audioOutput->open)
+ audioOutput->outAudioFormat =
+ audioOutput->reqAudioFormat;
} else {
audioOutput->outAudioFormat = audioOutput->inAudioFormat;
if (audioOutput->open)