Skip to content

Commit d5557e0

Browse files
committed
sink: document the frame-size divisor in free-frames
Free-frames divides the free size by the frame size, which is the channel count times the sample size. A zero divisor was the concern, as the channel count is host-supplied; it is now rejected at module init (module_adapter_ipc4.c) before it reaches the stream, and the sample size is fixed by a valid frame format. Document that invariant here rather than re-checking it on this hot path. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 3f7738d commit d5557e0

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/module/audio/sink_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ EXPORT_SYMBOL(sink_get_frame_bytes);
109109

110110
size_t sink_get_free_frames(struct sof_sink *sink)
111111
{
112+
/* The frame size is a valid divisor: a host channel count of zero is
113+
* rejected at module init (module_adapter_ipc4.c) before it reaches
114+
* the stream, and the sample size is fixed by a valid frame format, so
115+
* this is not re-checked on the hot path.
116+
*/
112117
return sink_get_free_size(sink) / sink_get_frame_bytes(sink);
113118
}
114119
EXPORT_SYMBOL(sink_get_free_frames);

0 commit comments

Comments
 (0)