buffer: Move buffer_params_match() implementation to buffer.c file

Assertions don't show proper location for functions implemented
in header file.
Before changes, example location of this assert was:
   Location: src/audio/pipeline.c:303

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This commit is contained in:
Karol Trzcinski 2020-10-16 15:08:20 +02:00 committed by Liam Girdwood
parent b72c7ec2df
commit fb838de413
3 changed files with 32 additions and 21 deletions

View File

@ -131,6 +131,26 @@ int buffer_set_size(struct comp_buffer *buffer, uint32_t size)
return 0;
}
bool buffer_params_match(struct comp_buffer *buffer, struct sof_ipc_stream_params *params,
uint32_t flag)
{
assert(params && buffer);
if ((flag & BUFF_PARAMS_FRAME_FMT) &&
buffer->stream.frame_fmt != params->frame_fmt)
return false;
if ((flag & BUFF_PARAMS_RATE) &&
buffer->stream.rate != params->rate)
return false;
if ((flag & BUFF_PARAMS_CHANNELS) &&
buffer->stream.channels != params->channels)
return false;
return true;
}
/* free component in the pipeline */
void buffer_free(struct comp_buffer *buffer)
{

View File

@ -165,6 +165,9 @@ void comp_update_buffer_produce(struct comp_buffer *buffer, uint32_t bytes);
/* called by a component after consuming data from this buffer */
void comp_update_buffer_consume(struct comp_buffer *buffer, uint32_t bytes);
bool buffer_params_match(struct comp_buffer *buffer, struct sof_ipc_stream_params *params,
uint32_t flag);
static inline void buffer_invalidate(struct comp_buffer *buffer, uint32_t bytes)
{
if (!buffer->inter_core)
@ -296,25 +299,4 @@ static inline int buffer_set_params(struct comp_buffer *buffer,
return 0;
}
static inline bool buffer_params_match(struct comp_buffer *buffer,
struct sof_ipc_stream_params *params,
uint32_t flag)
{
assert(params && buffer);
if ((flag & BUFF_PARAMS_FRAME_FMT) &&
buffer->stream.frame_fmt != params->frame_fmt)
return false;
if ((flag & BUFF_PARAMS_RATE) &&
buffer->stream.rate != params->rate)
return false;
if ((flag & BUFF_PARAMS_CHANNELS) &&
buffer->stream.channels != params->channels)
return false;
return true;
}
#endif /* __SOF_AUDIO_BUFFER_H__ */

View File

@ -130,3 +130,12 @@ int comp_verify_params(struct comp_dev *dev, uint32_t flag,
(void)params;
return 0;
}
bool buffer_params_match(struct comp_buffer *buffer, struct sof_ipc_stream_params *params,
uint32_t flag)
{
(void)buffer;
(void)params;
(void)flag;
return 0;
}