Cortex: SpecializeTo() once more before creating the operation.

If the incoming node is still pretty generic, we have to specialize
the input format to the output format in order to not be left with
wildcards.

Additionally, ensure that the frame sizes match up. MultiAudioNode
silently rejects buffers that are not sized precisely as it wants
them, so we need to attempt to have equivalent frame counts
on either end.
This commit is contained in:
Augustin Cavalier 2021-09-07 16:17:31 -04:00
parent 4f7febcdf2
commit dc912367ae

View File

@ -424,7 +424,19 @@ status_t AudioFilterNode::AcceptFormat(
return err;
// if an output connection has been made, try to create an operation
if(m_output.destination != media_destination::null) {
if (m_output.destination != media_destination::null) {
// Further specialize the format, in case of any remaining wildcards.
// Special case for buffer size: make sure we use the same frame count.
const bool setFrameSize = ioFormat->u.raw_audio.buffer_size
== media_raw_audio_format::wildcard.buffer_size;
ioFormat->SpecializeTo(&m_output.format);
if (setFrameSize) {
ioFormat->u.raw_audio.buffer_size =
bytes_per_frame(ioFormat->u.raw_audio)
* (m_output.format.u.raw_audio.buffer_size
/ bytes_per_frame(m_output.format.u.raw_audio));
}
ASSERT(m_opFactory);
IAudioOp* op = m_opFactory->createOp(
this,