summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrant Thomsen <brant.thomsen@harman.com>2017-07-18 14:13:37 -0600
committerBrant Thomsen <brant.thomsen@harman.com>2017-07-18 14:13:37 -0600
commit800c01b5c355c54747711794453978bcf251d0c4 (patch)
tree70b2bd8ccbb7e91f00d7138411c2c6e71f56c979
parent2ace6a894edff4c4c59a495e964d593e08fc334e (diff)
downloadOpen-AVB-800c01b5c355c54747711794453978bcf251d0c4.tar.gz
Functions changed to return the current state, rather than IsStreaming
The openavbAVDECCListenerIsStreaming() and openavbAVDECCTalkerIsStreaming() functions have been replaced with openavbAVDECCGetRequestedState() and openavbAVDECCGetStreamingState(), which allows for more flexibility. Changed the value of OPENAVB_AVDECC_MSG_STOPPED_UNEXPECTEDLY so that OPENAVB_AVDECC_MSG_RUNNING or greater values will indicate that the client is active. The version number was updated to reflect this change.
-rw-r--r--lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c24
-rw-r--r--lib/avtp_pipeline/avdecc/openavb_avdecc_pipeline_interaction_pub.h9
-rw-r--r--lib/avtp_pipeline/avdecc_msg/openavb_avdecc_msg.h2
-rw-r--r--lib/avtp_pipeline/include/openavb_pub.h2
-rw-r--r--lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_pipeline_interaction.c68
5 files changed, 41 insertions, 64 deletions
diff --git a/lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c b/lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c
index 9461553f..12b1f1ed 100644
--- a/lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c
+++ b/lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c
@@ -223,26 +223,20 @@ bool processCommandCheckRestriction_CorrectController()
}
// Returns TRUE the stream_input or stream_output descriptor is currently not running.
+// NOTE: This function is using the last reported state from the client, not the state AVDECC last told the client to be in.
bool processCommandCheckRestriction_StreamNotRunning(U16 descriptor_type, U16 descriptor_index)
{
AVB_TRACE_ENTRY(AVB_TRACE_AECP);
- bool bResult = FALSE;
+ bool bResult = TRUE;
- if (descriptor_type == OPENAVB_AEM_DESCRIPTOR_STREAM_INPUT) {
+ if (descriptor_type == OPENAVB_AEM_DESCRIPTOR_STREAM_INPUT ||
+ descriptor_type == OPENAVB_AEM_DESCRIPTOR_STREAM_OUTPUT) {
U16 configIdx = openavbAemGetConfigIdx();
- openavb_aem_descriptor_stream_io_t *pDescriptorStreamInput = openavbAemGetDescriptor(configIdx, descriptor_type, descriptor_index);
- if (pDescriptorStreamInput) {
- if (!openavbAVDECCListenerIsStreaming(pDescriptorStreamInput, configIdx)) {
- bResult = TRUE;
- }
- }
- }
- else if (descriptor_type == OPENAVB_AEM_DESCRIPTOR_STREAM_OUTPUT) {
- U16 configIdx = openavbAemGetConfigIdx();
- openavb_aem_descriptor_stream_io_t *pDescriptorStreamOutput = openavbAemGetDescriptor(configIdx, descriptor_type, descriptor_index);
- if (pDescriptorStreamOutput) {
- if (!openavbAVDECCTalkerIsStreaming(pDescriptorStreamOutput, configIdx)) {
- bResult = TRUE;
+ openavb_aem_descriptor_stream_io_t *pDescriptorStreamIO = openavbAemGetDescriptor(configIdx, descriptor_type, descriptor_index);
+ if (pDescriptorStreamIO) {
+ openavbAvdeccMsgStateType_t state = openavbAVDECCGetStreamingState(pDescriptorStreamIO, configIdx);
+ if (state >= OPENAVB_AVDECC_MSG_RUNNING) {
+ bResult = FALSE;
}
}
}
diff --git a/lib/avtp_pipeline/avdecc/openavb_avdecc_pipeline_interaction_pub.h b/lib/avtp_pipeline/avdecc/openavb_avdecc_pipeline_interaction_pub.h
index 9ba33ed0..6df3a4ad 100644
--- a/lib/avtp_pipeline/avdecc/openavb_avdecc_pipeline_interaction_pub.h
+++ b/lib/avtp_pipeline/avdecc/openavb_avdecc_pipeline_interaction_pub.h
@@ -34,6 +34,7 @@ https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
#include "openavb_acmp.h"
#include "openavb_descriptor_stream_io_pub.h"
+#include "openavb_avdecc_msg.h"
// Run a single talker or listener.
@@ -47,9 +48,11 @@ bool openavbAVDECCStopTalker(openavb_aem_descriptor_stream_io_t *pDescriptorStre
// Get talker stream details. Structure members in TalkerStrreamInfo will be filled.
bool openavbAVDECCGetTalkerStreamInfo(openavb_aem_descriptor_stream_io_t *pDescriptorStreamOutput, U16 configIdx, openavb_acmp_TalkerStreamInfo_t *pTalkerStreamInfo);
-// Determine if the talker or listener is streaming.
-bool openavbAVDECCListenerIsStreaming(openavb_aem_descriptor_stream_io_t *pDescriptorStreamInput, U16 configIdx);
-bool openavbAVDECCTalkerIsStreaming(openavb_aem_descriptor_stream_io_t *pDescriptorStreamOutput, U16 configIdx);
+// Get the streaming state (stopped, running, paused, etc.) AVDECC told the talker or listener to use.
+openavbAvdeccMsgStateType_t openavbAVDECCGetRequestedState(openavb_aem_descriptor_stream_io_t *pDescriptorStreamInput, U16 configIdx);
+
+// Get the streaming state (stopped, running, paused, etc.) last reported by the talker or listener.
+openavbAvdeccMsgStateType_t openavbAVDECCGetStreamingState(openavb_aem_descriptor_stream_io_t *pDescriptorStreamInput, U16 configIdx);
// Pause or resume the stream.
void openavbAVDECCPauseStream(openavb_aem_descriptor_stream_io_t *pDescriptor, bool bPause);
diff --git a/lib/avtp_pipeline/avdecc_msg/openavb_avdecc_msg.h b/lib/avtp_pipeline/avdecc_msg/openavb_avdecc_msg.h
index 01c6bde9..78c4f38e 100644
--- a/lib/avtp_pipeline/avdecc_msg/openavb_avdecc_msg.h
+++ b/lib/avtp_pipeline/avdecc_msg/openavb_avdecc_msg.h
@@ -79,9 +79,9 @@ void openavbAvdeccMsgSrvrService(void);
typedef enum {
OPENAVB_AVDECC_MSG_UNKNOWN = 0,
OPENAVB_AVDECC_MSG_STOPPED,
+ OPENAVB_AVDECC_MSG_STOPPED_UNEXPECTEDLY,
OPENAVB_AVDECC_MSG_RUNNING,
OPENAVB_AVDECC_MSG_PAUSED,
- OPENAVB_AVDECC_MSG_STOPPED_UNEXPECTEDLY,
} openavbAvdeccMsgStateType_t;
typedef enum {
diff --git a/lib/avtp_pipeline/include/openavb_pub.h b/lib/avtp_pipeline/include/openavb_pub.h
index 95fe6378..9e530cef 100644
--- a/lib/avtp_pipeline/include/openavb_pub.h
+++ b/lib/avtp_pipeline/include/openavb_pub.h
@@ -51,7 +51,7 @@ https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
#define AVB_CORE_VER_MAJOR (0)
#define AVB_CORE_VER_MINOR (1)
-#define AVB_CORE_VER_REVISION (2)
+#define AVB_CORE_VER_REVISION (3)
// Standard release designations. Uncomment one AVB_RELEASE_TYPE
#define AVB_CORE_RELEASE_TYPE "Development"
diff --git a/lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_pipeline_interaction.c b/lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_pipeline_interaction.c
index d88c0f85..be8db04a 100644
--- a/lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_pipeline_interaction.c
+++ b/lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_pipeline_interaction.c
@@ -275,76 +275,56 @@ bool openavbAVDECCGetTalkerStreamInfo(openavb_aem_descriptor_stream_io_t *pDescr
return TRUE;
}
-bool openavbAVDECCListenerIsStreaming(openavb_aem_descriptor_stream_io_t *pDescriptorStreamInput, U16 configIdx)
+openavbAvdeccMsgStateType_t openavbAVDECCGetRequestedState(openavb_aem_descriptor_stream_io_t *pDescriptorStream, U16 configIdx)
{
AVB_TRACE_ENTRY(AVB_TRACE_AVDECC);
// Sanity tests.
- if (!pDescriptorStreamInput) {
- AVB_LOG_ERROR("openavbAVDECCListenerIsStreaming Invalid descriptor");
+ if (!pDescriptorStream) {
+ AVB_LOG_ERROR("openavbAVDECCGetRequestedState Invalid descriptor");
AVB_TRACE_EXIT(AVB_TRACE_AVDECC);
- return FALSE;
+ return OPENAVB_AVDECC_MSG_UNKNOWN;
}
- if (!pDescriptorStreamInput->stream) {
- AVB_LOG_ERROR("openavbAVDECCListenerIsStreaming Invalid StreamInput descriptor stream");
+ if (!pDescriptorStream->stream) {
+ AVB_LOG_ERROR("openavbAVDECCGetRequestedState Invalid descriptor stream");
AVB_TRACE_EXIT(AVB_TRACE_AVDECC);
- return FALSE;
+ return OPENAVB_AVDECC_MSG_UNKNOWN;
}
- if (!pDescriptorStreamInput->stream->client) {
- AVB_LOG_ERROR("openavbAVDECCListenerIsStreaming Invalid stream client pointer");
+ if (!pDescriptorStream->stream->client) {
+ AVB_LOG_ERROR("openavbAVDECCGetRequestedState Invalid stream client pointer");
AVB_TRACE_EXIT(AVB_TRACE_AVDECC);
- return FALSE;
+ return OPENAVB_AVDECC_MSG_UNKNOWN;
}
- // Return the current Listener state.
- // If the state is not known, assume the Listener is not running.
- if (pDescriptorStreamInput->stream->client->lastReportedState == OPENAVB_AVDECC_MSG_RUNNING) {
- AVB_TRACE_EXIT(AVB_TRACE_AVDECC);
- return TRUE;
- }
- if (pDescriptorStreamInput->stream->client->lastReportedState != OPENAVB_AVDECC_MSG_STOPPED) {
- AVB_LOG_WARNING("Listener state unknown");
- AVB_TRACE_EXIT(AVB_TRACE_AVDECC);
- return FALSE;
- }
+ // Return the current state.
AVB_TRACE_EXIT(AVB_TRACE_AVDECC);
- return FALSE;
+ return pDescriptorStream->stream->client->lastRequestedState;
}
-bool openavbAVDECCTalkerIsStreaming(openavb_aem_descriptor_stream_io_t *pDescriptorStreamOutput, U16 configIdx)
+openavbAvdeccMsgStateType_t openavbAVDECCGetStreamingState(openavb_aem_descriptor_stream_io_t *pDescriptorStream, U16 configIdx)
{
AVB_TRACE_ENTRY(AVB_TRACE_AVDECC);
// Sanity tests.
- if (!pDescriptorStreamOutput) {
- AVB_LOG_ERROR("openavbAVDECCTalkerIsStreaming Invalid descriptor");
+ if (!pDescriptorStream) {
+ AVB_LOG_ERROR("openavbAVDECCGetStreamingState Invalid descriptor");
AVB_TRACE_EXIT(AVB_TRACE_AVDECC);
- return FALSE;
+ return OPENAVB_AVDECC_MSG_UNKNOWN;
}
- if (!pDescriptorStreamOutput->stream) {
- AVB_LOG_ERROR("openavbAVDECCTalkerIsStreaming Invalid StreamInput descriptor stream");
+ if (!pDescriptorStream->stream) {
+ AVB_LOG_ERROR("openavbAVDECCGetStreamingState Invalid descriptor stream");
AVB_TRACE_EXIT(AVB_TRACE_AVDECC);
- return FALSE;
+ return OPENAVB_AVDECC_MSG_UNKNOWN;
}
- if (!pDescriptorStreamOutput->stream->client) {
- AVB_LOG_ERROR("openavbAVDECCTalkerIsStreaming Invalid stream client pointer");
+ if (!pDescriptorStream->stream->client) {
+ AVB_LOG_ERROR("openavbAVDECCGetStreamingState Invalid stream client pointer");
AVB_TRACE_EXIT(AVB_TRACE_AVDECC);
- return FALSE;
+ return OPENAVB_AVDECC_MSG_UNKNOWN;
}
- // Return the current Talker state.
- // If the state is not known, assume the Talker is not running.
- if (pDescriptorStreamOutput->stream->client->lastReportedState == OPENAVB_AVDECC_MSG_RUNNING) {
- AVB_TRACE_EXIT(AVB_TRACE_AVDECC);
- return TRUE;
- }
- if (pDescriptorStreamOutput->stream->client->lastReportedState != OPENAVB_AVDECC_MSG_STOPPED) {
- AVB_LOG_WARNING("Talker state unknown");
- AVB_TRACE_EXIT(AVB_TRACE_AVDECC);
- return FALSE;
- }
+ // Return the current state.
AVB_TRACE_EXIT(AVB_TRACE_AVDECC);
- return FALSE;
+ return pDescriptorStream->stream->client->lastReportedState;
}
void openavbAVDECCPauseStream(openavb_aem_descriptor_stream_io_t *pDescriptor, bool bPause)