Skip to content

Commit f152233

Browse files
committed
mixin: Add EOS notification
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent 0fd920f commit f152233

File tree

1 file changed

+9
-53
lines changed

1 file changed

+9
-53
lines changed

src/audio/mixin_mixout/mixin_mixout.c

Lines changed: 9 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -249,66 +249,24 @@ static void silence(struct cir_buf_ptr *stream, uint32_t start_offset,
249249
}
250250

251251
#if CONFIG_XRUN_NOTIFICATIONS_ENABLE
252-
static bool mixin_check_eos(const struct pipeline *pipeline)
253-
{
254-
#if 0
255-
assert(get_prid() == MASTER_CORE_ID);
256-
257-
//
258-
if (GetState() != PPL_EOS)
259-
{
260-
#pragma frequency_hint NEVER
261-
REPORT_ERROR(ADSP_PPL_CHECK_EOS_INVALID_STATE);
262-
return false;
263-
}
264-
struct comp_dev *source_comp;
265-
266-
Gateway* gateway = GetGateway(Gateway::SOURCE);
267-
if (gateway == NULL)
268-
{
269-
#pragma frequency_hint NEVER
270-
REPORT_ERROR(ADSP_PPL_CHECK_EOS_WITHOUT_GATEWAY_SOUCE);
271-
return false;
272-
}
273-
274-
Source* source = reinterpret_cast<GatewaySource*>(gateway);
275-
assert(source != NULL);
276-
277-
if (source->GetDataSize() != 0)
278-
{
279-
#pragma frequency_hint NEVER
280-
REPORT_ERROR(ADSP_PPL_CHECK_EOS_GTW_SOURCE_NOT_EMPTY);
281-
return false;
282-
}
283-
284-
for (const QueueList::Item* it = queues_.GetHead(); it != NULL; it = it->next)
285-
{
286-
if (it->elem->GetDataSize() != 0)
287-
{
288-
REPORT_ERROR(ADSP_PPL_CHECK_EOS_INTERNAL_QUEUE_NOT_EMPTY);
289-
return false;
290-
}
291-
}
292-
293-
#endif
294-
return true;
295-
}
296-
297252
static void mixin_check_notify_underrun(struct comp_dev *dev, struct mixin_data *mixin_data,
253+
enum sof_audio_stream_state state,
298254
size_t source_avail, size_t sinks_free)
299255
{
300-
const bool eos_detected = dev->pipeline->expect_eos && mixin_check_eos(dev->pipeline);
256+
const bool eos_detected = state == STREAM_STATE_END_OF_STREAM_FLUSH ||
257+
state == STREAM_STATE_END_OF_STREAM;
301258

302259
mixin_data->last_reported_underrun++;
303260

304-
if (source_avail < sinks_free) {
261+
if (!source_avail || eos_detected) {
305262
// TODO: Tutaj brakuje sprawdzenia czy brak danych nie wynika z oczekiwania na modul DP
306263

307264
if (eos_detected) {
308265
if (mixin_data->eos_delay_configured)
309266
mixin_data->eos_delay--;
310267
else {
311-
mixin_data->eos_delay = 100;// TODO: Pipe latency calculation
268+
pipeline_get_dai_comp_latency(dev->pipeline->pipeline_id,
269+
&mixin_data->eos_delay);
312270
mixin_data->eos_delay_configured = true;
313271
}
314272
}
@@ -450,12 +408,10 @@ static int mixin_process(struct processing_module *mod,
450408

451409
#if CONFIG_XRUN_NOTIFICATIONS_ENABLE
452410
size_t frame_bytes = source_get_frame_bytes(sources[0]);
453-
comp_err(dev, "%u %u %u", (uint32_t)source_avail_frames, (uint32_t)sinks_free_frames, (uint32_t)dev->frames);
454-
455411
size_t min_frames = MIN(dev->frames, sinks_free_frames);
456-
mixin_check_notify_underrun(dev, mixin_data,
457-
source_avail_frames,// * frame_bytes,
458-
min_frames);// *frame_bytes);
412+
mixin_check_notify_underrun(dev, mixin_data, source_get_state(sources[0]),
413+
source_avail_frames * frame_bytes,
414+
min_frames * frame_bytes);
459415
#endif
460416

461417
if (source_avail_frames > 0) {

0 commit comments

Comments
 (0)