Skip to content

Fixed out of order talker samples#35

Open
akp7 wants to merge 3 commits into
xmos:masterfrom
akp7:master
Open

Fixed out of order talker samples#35
akp7 wants to merge 3 commits into
xmos:masterfrom
akp7:master

Conversation

@akp7

@akp7 akp7 commented Oct 18, 2017

Copy link
Copy Markdown

Fixed out of order samples discussed here https://www.xcore.com/viewtopic.php?p=30728

@xross

xross commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Could do with a rebase/squash to remove the semi-colon commit.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses out-of-order AVB talker samples and broadens support for “talker-only” / “no sinks / no listeners / no media outputs” build configurations by adding null-safe handling and conditional compilation across AVB, media clock, buffering, and example applications.

Changes:

  • Update the 1722 talker transmit path to avoid overwriting queued packets and to flush pending TX buffers deterministically.
  • Add conditional compilation and null checks to support configurations with AVB_NUM_SINKS == 0, AVB_NUM_LISTENER_UNITS == 0, and/or AVB_NUM_MEDIA_OUTPUTS == 0.
  • Update 1722.1 descriptor/control logic and public API signatures to align with the new optional/conditional features.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib_tsn/src/media_clock/media_clock_support.c Guard stream-derived clock recovery logic behind AVB_NUM_SINKS > 0.
lib_tsn/src/media_clock/media_clock_server.xc Make buffer-control chanend array optional and add guards for output-only builds.
lib_tsn/src/avb/avb.xc Avoid registering listeners / updating sinks when listener units are not present.
lib_tsn/src/audio_buffering/audio_buffering.xc Make audio output pull interface optional and add runtime checks around output usage.
lib_tsn/src/audio_buffering/audio_buffering.h Update audio_buffer_manager() signature to accept an optional output interface.
lib_tsn/src/1722/maap/avb_1722_maap.xc Fix missing semicolon in debug print.
lib_tsn/src/1722/avb_1722_talker.xc Prevent out-of-order samples by sending queued packets before overwriting and flushing one queued packet per call.
lib_tsn/src/1722_1/avb_1722_1_aecp.c Adjust AEM descriptor generation/guards for sink-less builds and correct mapping offsets.
lib_tsn/src/1722_1/avb_1722_1_aecp_controls.xc Fix start/stop streaming logic to use source state for stream outputs.
lib_tsn/api/avb.h Gate stream-derived clock enum by sinks, tighten clock-type logging, and update server signature.
examples/AN00203_gige_avb_tdm_demo/src/main.xc Add #if guards and null wiring for builds without outputs/listeners.
examples/AN00203_gige_avb_tdm_demo/src/aem_descriptors.h.in Make descriptor counts conditional on sinks; adjust clock source descriptor list.
examples/AN00202_gige_avb_i2s_demo/src/main.xc Add #if guards and null wiring for builds without outputs/listeners.
examples/AN00202_gige_avb_i2s_demo/src/aem_descriptors.h.in Make descriptor counts conditional on sinks; correct stream output label counts; adjust clock source descriptor list.
Comments suppressed due to low confidence (2)

examples/AN00202_gige_avb_i2s_demo/src/aem_descriptors.h.in:524

  • The #if (AVB_NUM_SINKS > 0) / #endif block currently spans across the end of desc_clock_source_0 and into the start of desc_clock_source_1, which will produce invalid C when AVB_NUM_SINKS == 0 (unterminated initializer / stray tokens). Restructure the preprocessor so each descriptor array is syntactically complete in both configurations.
#if (AVB_NUM_SINKS > 0)
  "Input Stream",                             /* 4-67 object_name */
  U16(AEM_NO_STRING),                         /* 68-69 localized_description */
  U16(AEM_CLOCK_SOURCE_FLAGS_LOCAL_ID),       /* 70-71 clock_source_flags */
  U16(AEM_CLOCK_SOURCE_INPUT_STREAM),         /* 72-73 clock_source_type */

examples/AN00203_gige_avb_tdm_demo/src/aem_descriptors.h.in:498

  • The #if (AVB_NUM_SINKS > 0) / #endif block currently spans across the end of desc_clock_source_0 and into the start of desc_clock_source_1, which will produce invalid C when AVB_NUM_SINKS == 0 (unterminated initializer / stray tokens). Restructure the preprocessor so each descriptor array is syntactically complete in both configurations.
#if (AVB_NUM_SINKS > 0)
  "Input Stream",                             /* 4-67 object_name */
  U16(AEM_NO_STRING),                         /* 68-69 localized_description */
  U16(AEM_CLOCK_SOURCE_FLAGS_LOCAL_ID),       /* 70-71 clock_source_flags */
  U16(AEM_CLOCK_SOURCE_INPUT_STREAM),         /* 72-73 clock_source_type */

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +119 to +131
buffer_handle_t h_out = null;
audio_output_fifo_t *unsafe output_sample_buf = null;
unsigned ctl_command;
unsigned sample_rate;

if( !isnull(audio_output_buf) && AVB_NUM_MEDIA_OUTPUTS )
{
h_out = audio_output_buf.get_handle();
output_sample_buf = (audio_output_fifo_t *unsafe)((struct output_finfo *)h_out)->p_buffer;
}
media_ctl_register(c_media_ctl, AVB_NUM_MEDIA_INPUTS,
output_sample_buf, AVB_NUM_MEDIA_OUTPUTS, 0);

Comment on lines 66 to +70
U16(AEM_CLOCK_SOURCE_TYPE),
#if (AVB_NUM_SINKS > 0)
U16(2),
#else
U16(1),
Comment on lines 66 to +70
U16(AEM_CLOCK_SOURCE_TYPE),
#if (AVB_NUM_SINKS > 0)
U16(2),
#else
U16(1),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants