mirror of https://github.com/mpv-player/mpv
ao_pipewire: validate pod creation
Our allocated buffers should be big enough, but add some errorhandling just in case.
This commit is contained in:
parent
b7a71ea706
commit
09343bc86e
|
@ -166,6 +166,10 @@ static void on_param_changed(void *userdata, uint32_t id, const struct spa_pod *
|
||||||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(ao->num_planes),
|
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(ao->num_planes),
|
||||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(buffer_size),
|
SPA_PARAM_BUFFERS_size, SPA_POD_Int(buffer_size),
|
||||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(ao->sstride));
|
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(ao->sstride));
|
||||||
|
if (!params[0]) {
|
||||||
|
MP_ERR(ao, "Could not build parameter pod\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pw_stream_update_params(p->stream, params, 1);
|
pw_stream_update_params(p->stream, params, 1);
|
||||||
}
|
}
|
||||||
|
@ -409,6 +413,8 @@ static int init(struct ao *ao)
|
||||||
audio_info.position[i] = mp_speaker_id_to_spa(ao, ao->channels.speaker[i]);
|
audio_info.position[i] = mp_speaker_id_to_spa(ao, ao->channels.speaker[i]);
|
||||||
|
|
||||||
params[0] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, &audio_info);
|
params[0] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, &audio_info);
|
||||||
|
if (!params[0])
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (af_fmt_is_planar(ao->format)) {
|
if (af_fmt_is_planar(ao->format)) {
|
||||||
ao->num_planes = ao->channels.num;
|
ao->num_planes = ao->channels.num;
|
||||||
|
|
Loading…
Reference in New Issue