summaryrefslogtreecommitdiff
path: root/lib/avtp_pipeline/tl/openavb_talker_endpoint.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/avtp_pipeline/tl/openavb_talker_endpoint.c')
-rw-r--r--lib/avtp_pipeline/tl/openavb_talker_endpoint.c68
1 files changed, 52 insertions, 16 deletions
diff --git a/lib/avtp_pipeline/tl/openavb_talker_endpoint.c b/lib/avtp_pipeline/tl/openavb_talker_endpoint.c
index 27511f96..c1a5eb4e 100644
--- a/lib/avtp_pipeline/tl/openavb_talker_endpoint.c
+++ b/lib/avtp_pipeline/tl/openavb_talker_endpoint.c
@@ -1,16 +1,17 @@
/*************************************************************************************************************
Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
+Copyright (c) 2016-2017, Harman International Industries, Incorporated
All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -21,15 +22,15 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Attributions: The inih library portion of the source code is licensed from
-Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
-Complete license and copyright information can be found at
+
+Attributions: The inih library portion of the source code is licensed from
+Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
+Complete license and copyright information can be found at
https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
*************************************************************************************************************/
/*
-* MODULE SUMMARY : Talker implementation for use with endpoint
+* MODULE SUMMARY : Talker implementation for use with endpoint
*/
#include <stdlib.h>
@@ -41,6 +42,7 @@ https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
#include "openavb_avtp.h"
#include "openavb_talker.h"
#include "openavb_time.h"
+#include "openavb_avdecc_msg.h"
// DEBUG Uncomment to turn on logging for just this module.
//#define AVB_LOG_ON 1
@@ -56,6 +58,7 @@ void openavbEptClntNotifyTlkrOfSrpCb(int endpointHandle,
char *ifname,
U8 destAddr[],
openavbSrpLsnrDeclSubtype_t lsnrDecl,
+ U8 srClass,
U32 classRate,
U16 vlanID,
U8 priority,
@@ -71,16 +74,29 @@ void openavbEptClntNotifyTlkrOfSrpCb(int endpointHandle,
return;
}
+ // If not a talker, ignore this callback.
+ if (pTLState->cfg.role != AVB_ROLE_TALKER) {
+ AVB_LOG_DEBUG("Ignoring Talker callback");
+ return;
+ }
+
AVB_LOGF_DEBUG("%s streaming=%d, lsnrDecl=%d", __FUNCTION__, pTLState->bStreaming, lsnrDecl);
+ openavb_tl_cfg_t *pCfg = &pTLState->cfg;
+
if (!pTLState->bStreaming) {
if (lsnrDecl == openavbSrp_LDSt_Ready
|| lsnrDecl == openavbSrp_LDSt_Ready_Failed) {
// Save the data provided by endpoint/SRP
- strncpy(pTalkerData->ifname, ifname, IFNAMSIZ);
+ if (!pCfg->ifname[0]) {
+ strncpy(pTalkerData->ifname, ifname, sizeof(pTalkerData->ifname) - 1);
+ } else {
+ strncpy(pTalkerData->ifname, pCfg->ifname, sizeof(pTalkerData->ifname) - 1);
+ }
memcpy(&pTalkerData->streamID, streamID, sizeof(AVBStreamID_t));
memcpy(&pTalkerData->destAddr, destAddr, ETH_ALEN);
+ pTalkerData->srClass = srClass;
pTalkerData->classRate = classRate;
pTalkerData->vlanID = vlanID;
pTalkerData->vlanPCP = priority;
@@ -92,9 +108,14 @@ void openavbEptClntNotifyTlkrOfSrpCb(int endpointHandle,
}
else if (lsnrDecl == openavbSrp_LDSt_Stream_Info) {
// Stream information is available does NOT mean listener is ready. Stream not started yet.
- strncpy(pTalkerData->ifname, ifname, IFNAMSIZ);
+ if (!pCfg->ifname[0]) {
+ strncpy(pTalkerData->ifname, ifname, sizeof(pTalkerData->ifname) - 1);
+ } else {
+ strncpy(pTalkerData->ifname, pCfg->ifname, sizeof(pTalkerData->ifname) - 1);
+ }
memcpy(&pTalkerData->streamID, streamID, sizeof(AVBStreamID_t));
memcpy(&pTalkerData->destAddr, destAddr, ETH_ALEN);
+ pTalkerData->srClass = srClass;
pTalkerData->classRate = classRate;
pTalkerData->vlanID = vlanID;
pTalkerData->vlanPCP = priority;
@@ -110,6 +131,14 @@ void openavbEptClntNotifyTlkrOfSrpCb(int endpointHandle,
}
}
+ // Let the AVDECC Msg server know our current stream ID, in case it was updated by MAAP.
+ if (pTLState->avdeccMsgHandle != AVB_AVDECC_MSG_HANDLE_INVALID) {
+ if (!openavbAvdeccMsgClntTalkerStreamID(pTLState->avdeccMsgHandle,
+ pTalkerData->srClass, pTalkerData->streamID.addr, pTalkerData->streamID.uniqueID,
+ pTalkerData->destAddr, pTalkerData->vlanID)) {
+ AVB_LOG_ERROR("openavbAvdeccMsgClntTalkerStreamID() failed");
+ }
+ }
AVB_TRACE_EXIT(AVB_TRACE_TL);
}
@@ -149,13 +178,20 @@ bool openavbTLRunTalkerInit(tl_state_t *pTLState)
// Tell endpoint to register our stream.
// SRP will send out talker declarations on the LAN.
// If there are listeners, we'll get callback (above.)
+ U32 transmitInterval = pTalkerData->classRate;
+ if (pCfg->map_cb.map_transmit_interval_cb(pTLState->pMediaQ)) {
+ // Override the class observation interval with the one provided by the mapping module.
+ transmitInterval = pCfg->map_cb.map_transmit_interval_cb(pTLState->pMediaQ);
+ }
return (openavbEptClntRegisterStream(pTLState->endpointHandle,
- &streamID,
- pCfg->dest_addr.mac->ether_addr_octet,
- &pTalkerData->tSpec,
- pCfg->sr_class,
- pCfg->sr_rank,
- pCfg->internal_latency));
+ &streamID,
+ pCfg->dest_addr.mac->ether_addr_octet,
+ pCfg->backup_dest_addr_valid, // If we have a backup dest_addr, then the current one was forced and MAAP should not be used.
+ &pTalkerData->tSpec,
+ pCfg->sr_class,
+ pCfg->sr_rank,
+ pCfg->internal_latency,
+ transmitInterval));
}
void openavbTLRunTalkerFinish(tl_state_t *pTLState)