Skip to content

Commit

Permalink
make sure S-TSID is sent before sending first packet of init segment …
Browse files Browse the repository at this point in the history
…for VoD sources - cf #2702
  • Loading branch information
jeanlf committed Dec 14, 2023
1 parent bbf2521 commit f8a41b2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/filters/out_route.c
Expand Up @@ -890,7 +890,7 @@ static GF_Err routeout_check_service_updates(GF_ROUTEOutCtx *ctx, ROUTEService *

//not ready, waiting for manifest
if (!serv->manifest && !nb_raw_files) {
return GF_OK;
return GF_NOT_READY;
}
//already setup and no changes
else if (!serv->wait_for_inputs) {
Expand Down Expand Up @@ -1055,7 +1055,8 @@ static GF_Err routeout_check_service_updates(GF_ROUTEOutCtx *ctx, ROUTEService *
char szIP[GF_MAX_IP_NAME_LEN];
src_ip = ctx->ifce;
if (!src_ip) {
gf_sk_get_local_ip(rlct->sock, szIP);
if (gf_sk_get_local_ip(rlct->sock, szIP) != GF_OK)
strcpy(szIP, "127.0.0.1");
src_ip = szIP;
}

Expand Down Expand Up @@ -1669,10 +1670,12 @@ static GF_Err routeout_process_service(GF_ROUTEOutCtx *ctx, ROUTEService *serv)
GF_Err e;

e = routeout_check_service_updates(ctx, serv);
if (e==GF_NOT_READY)
return GF_OK;

if (serv->stsid_bundle) {
u64 diff = ctx->clock - serv->last_stsid_clock;
if (diff >= ctx->carousel) {
if (!serv->last_stsid_clock || (diff >= ctx->carousel)) {
routeout_service_send_bundle(ctx, serv);
serv->last_stsid_clock = ctx->clock;
} else {
Expand Down Expand Up @@ -2004,7 +2007,8 @@ static void routeout_send_lls(GF_ROUTEOutCtx *ctx)

src_ip = ctx->ifce;
if (!src_ip) {
gf_sk_get_local_ip(serv->rlct_base->sock, szIP);
if (gf_sk_get_local_ip(serv->rlct_base->sock, szIP)!=GF_OK)
strcpy(szIP, "127.0.0.1");
src_ip = szIP;
}
int res = snprintf(tmp, 1000, " <BroadcastSvcSignaling slsProtocol=\"1\" slsDestinationIpAddress=\"%s\" slsDestinationUdpPort=\"%d\" slsSourceIpAddress=\"%s\"/>\n"
Expand Down
3 changes: 2 additions & 1 deletion src/ietf/rtsp_session.c
Expand Up @@ -1023,7 +1023,8 @@ GF_EXPORT
GF_Err gf_rtsp_get_session_ip(GF_RTSPSession *sess, char buffer[GF_MAX_IP_NAME_LEN])
{
if (!sess || !sess->connection) return GF_BAD_PARAM;
gf_sk_get_local_ip(sess->connection, buffer);
if (gf_sk_get_local_ip(sess->connection, buffer) != GF_OK)
strcpy(buffer, "127.0.0.1");
return GF_OK;
}

Expand Down
2 changes: 2 additions & 0 deletions src/utils/os_net.c
Expand Up @@ -641,6 +641,8 @@ GF_Err gf_sk_get_local_ip(GF_Socket *sock, char *buffer)
} else {
struct sockaddr_storage clientaddr;
socklen_t addrlen = sizeof(clientaddr);
if (sock->flags & GF_SOCK_IS_MULTICAST)
return GF_BAD_PARAM;
if (getsockname(sock->socket, (struct sockaddr *)&clientaddr, &addrlen)) return GF_IP_NETWORK_FAILURE;

if (getnameinfo((struct sockaddr *)&clientaddr, addrlen, clienthost, sizeof(clienthost), NULL, 0, NI_NUMERICHOST))
Expand Down

0 comments on commit f8a41b2

Please sign in to comment.