Skip to content

Commit 1414b9a

Browse files
committed
audio: stream: Add end of stream state
Add new STREAM_STATE_END_OF_STREAM state indicating the end of a stream. Additional state STREAM_STATE_END_OF_STREAM_FLUSH indicates that end of stream has been detected, but silence is transmitted for the needs of DP modules. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent 7306c69 commit 1414b9a

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

src/include/module/audio/audio_stream.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
enum sof_audio_stream_state {
1717
STREAM_STATE_INITIAL, /* Initial state, hw params not configured. */
1818
STREAM_STATE_READY, /* Stream ready, hw params configured */
19+
STREAM_STATE_END_OF_STREAM, /* Detected End Of Stream */
20+
STREAM_STATE_END_OF_STREAM_FLUSH, /* Detected End Of Stream, generating silence
21+
* to flush buffers in dp modules.
22+
*/
1923
};
2024

2125
/**

src/include/module/audio/source_api.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,4 +323,9 @@ static inline struct processing_module *source_get_bound_module(struct sof_sourc
323323
return source->bound_module;
324324
}
325325

326+
static inline enum sof_audio_stream_state source_get_state(const struct sof_source *source)
327+
{
328+
return source->audio_stream_params->state;
329+
}
330+
326331
#endif /* __MODULE_AUDIO_SOURCE_API_H__ */

src/include/sof/audio/audio_buffer.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,23 @@ static inline void audio_buffer_reset_params(struct sof_audio_buffer *buffer)
227227
buffer->audio_stream_params->state = STREAM_STATE_INITIAL;
228228
}
229229

230+
static inline enum sof_audio_stream_state audio_buffer_get_state(
231+
const struct sof_audio_buffer *buffer)
232+
{
233+
return buffer->audio_stream_params->state;
234+
}
235+
236+
static inline void audio_buffer_set_state(struct sof_audio_buffer *buffer,
237+
enum sof_audio_stream_state state)
238+
{
239+
buffer->audio_stream_params->state = state;
240+
}
241+
242+
static inline void audio_buffer_set_eos(struct sof_audio_buffer *buffer)
243+
{
244+
buffer->audio_stream_params->state = STREAM_STATE_END_OF_STREAM;
245+
}
246+
230247
static inline uint16_t audio_buffer_get_chmap(struct sof_audio_buffer *buffer, size_t index)
231248
{
232249
return buffer->audio_stream_params->chmap[index];

0 commit comments

Comments
 (0)