summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-25 17:32:00 +0200
committerwm4 <wm4@nowhere>2015-06-25 17:32:00 +0200
commitfd1194de3c4b14126269f2db918c0f8bcf2bf34a (patch)
treedbc3146079a212b5fb17c7aa3941a90d0834ef74 /test
parent5d71188c9939a0a881b82982efb5203d6704fd0b (diff)
downloadmpv-fd1194de3c4b14126269f2db918c0f8bcf2bf34a.tar.bz2
mpv-fd1194de3c4b14126269f2db918c0f8bcf2bf34a.tar.xz
audio: fix channel map fallback selection (again)
The speaker replacement nonsense sometimes made blatantly incorrect decisions. In this case, it prefered a 7.1(rear) upmix over outputting 5.1(side) as 5.1, which makes no sense at all. This happened because 5.1 and 7.1(rear) appeared equivalent to the final selection, as both of them lose the sl-sr channels. The old code was too stupid to select the one with the lower number of channels as well. Redo this. There's really no reason why there should be a separate final decision, so move the speaker replacement logic into the mp_chmap_is_better() function. Improve some other details. For example, we never should compare the plain number of channels for deciding upmix/downmix, because due to NA channels this is essentially meaningless. Remove the NA channels when doing this comparison. Also, explicitly handle exact matches. Conceptually this is not necessary, but it avoids that we have to needlessly shuffle audio data around.
Diffstat (limited to 'test')
-rw-r--r--test/chmap_sel.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/chmap_sel.c b/test/chmap_sel.c
index f4299e1146..0301045e23 100644
--- a/test/chmap_sel.c
+++ b/test/chmap_sel.c
@@ -99,6 +99,15 @@ static void test_mp_chmap_sel_fallback_more_replacements(void **state) {
LAYOUTS("fl-fr-bl-br-na-na-na-na", "quad(side)", "stereo"));
test_sel("quad", "fl-fr-bl-br-na-na-na-na",
LAYOUTS("stereo", "quad(side)", "fl-fr-bl-br-na-na-na-na"));
+ test_sel("fl-fr-fc-lfe-sl-sr", "fl-fr-lfe-fc-bl-br-na-na",
+ LAYOUTS("fl-fr-lfe-fc-bl-br-na-na", "fl-fr-lfe-fc-bl-br-sdl-sdr"));
+ test_sel("fl-fr-fc-lfe-sl-sr", "fl-fr-lfe-fc-bl-br-na-na",
+ LAYOUTS("fl-fr-lfe-fc-bl-br-sdl-sdr", "fl-fr-lfe-fc-bl-br-na-na"));
+}
+
+static void test_mp_chmap_sel_fallback_na_channels(void **state) {
+ test_sel("na-fl-fr", "na-fl-fr", LAYOUTS("na-fl-fr-na", "fl-na-fr", "na-fl-fr",
+ "fl-fr-na-na", "na-na-fl-fr"));
}
int main(void) {
@@ -116,6 +125,7 @@ int main(void) {
cmocka_unit_test(test_mp_chmap_sel_fallback_minimal_downmix),
cmocka_unit_test(test_mp_chmap_sel_fallback_reject_unknown),
cmocka_unit_test(test_mp_chmap_sel_fallback_more_replacements),
+ cmocka_unit_test(test_mp_chmap_sel_fallback_na_channels),
};
return cmocka_run_group_tests(tests, NULL, NULL);
}