diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2016-01-04 17:04:40 -0800 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2016-01-05 17:47:55 -0800 |
commit | fb84c6974d0026aab7e23aedd4136952b1c6ab7b (patch) | |
tree | 0c2d1af7ab406ba9cecb44e3933515391d977148 /audio/out/ao_wasapi_utils.c | |
parent | 92ded6c6fd4a561e94c424a249fdba916f254bda (diff) | |
download | mpv-fb84c6974d0026aab7e23aedd4136952b1c6ab7b.tar.bz2 mpv-fb84c6974d0026aab7e23aedd4136952b1c6ab7b.tar.xz |
ao_wasapi: avoid some redundant error messages in device selection
If these error conditions are triggered, the called function will have already
output a sufficiently informantive error message.
Diffstat (limited to 'audio/out/ao_wasapi_utils.c')
-rw-r--r-- | audio/out/ao_wasapi_utils.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c index 39dbbb2cae..10f686c6ab 100644 --- a/audio/out/ao_wasapi_utils.c +++ b/audio/out/ao_wasapi_utils.c @@ -906,6 +906,8 @@ exit_label: static void select_device(struct wasapi_state *state, struct device_desc *d) { + if (!d) + return; MP_VERBOSE(state, "Selecting device \'%s\' (%s)\n", d->id, d->name); state->deviceID = talloc_memdup(NULL, d->deviceID, (wcslen(d->deviceID) + 1) * sizeof(wchar_t)); @@ -946,13 +948,9 @@ static HRESULT find_device(struct ao *ao) goto exit_label; if (!device.len) { + MP_VERBOSE(ao, "No device specified. Selecting default.\n"); d = default_device_desc(enumerator); - if (d) { - MP_VERBOSE(ao, "No device specified. Selecting default\n"); - select_device(state, d); - } else { - MP_ERR(ao, "Failed to get default device.\n"); - } + select_device(state, d); goto exit_label; } @@ -960,13 +958,9 @@ static HRESULT find_device(struct ao *ao) bstr rest; long long devno = bstrtoll(device, &rest, 10); if (!rest.len && 0 <= devno && devno < enumerator->count) { + MP_VERBOSE(ao, "Selecting device by number: #%lld\n", devno); d = device_desc_for_num(enumerator, devno); - if (d) { - MP_VERBOSE(ao, "Selecting device by number: #%lld\n", devno); - select_device(state, d); - } else { - MP_ERR(ao, "Failed to get device #%lld.\n", devno); - } + select_device(state, d); goto exit_label; } @@ -974,10 +968,8 @@ static HRESULT find_device(struct ao *ao) bstr_eatstart0(&device, "{0.0.0.00000000}."); for (int i = 0; i < enumerator->count; i++) { d = device_desc_for_num(enumerator, i); - if (!d) { - MP_ERR(ao, "Failed to get device #%d.\n", i); + if (!d) goto exit_label; - } if (bstrcmp(device, bstr_strip(bstr0(d->id))) == 0) { MP_VERBOSE(ao, "Selecting device by id: \'%.*s\'\n", BSTR_P(device)); |