Skip to content

Commit

Permalink
added warning when using static HAS with route and fixed bugs missing…
Browse files Browse the repository at this point in the history
… audio stream type detection in file forward mode - cf #2789
  • Loading branch information
jeanlf committed Apr 5, 2024
1 parent 2995a6d commit 61146d5
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/filter_core/filter_props.c
Expand Up @@ -1674,7 +1674,7 @@ GF_BuiltInProperty GF_BuiltInProps [] =
DEC_PROP( GF_PROP_PID_SCENE_NODE, "SceneNode", "PID is a scene node decoder (AFX BitWrapper in BIFS)", GF_PROP_BOOL),
DEC_PROP( GF_PROP_PID_ORIG_CRYPT_SCHEME, "OrigCryptoScheme", "Original crypto scheme on a decrypted PID", GF_PROP_4CC),
DEC_PROP_F( GF_PROP_PID_TIMESHIFT_SEGS, "TSBSegs", "Time shift in number of segments for HAS streams, only set by dashin and dasher filters", GF_PROP_UINT, GF_PROP_FLAG_GSF_REM),
DEC_PROP_F( GF_PROP_PID_IS_MANIFEST, "IsManifest", "PID is a HAS manifest\n"
DEC_PROP_F( GF_PROP_PID_IS_MANIFEST, "IsManifest", "PID is a HAS manifest (MSB=1 if live)\n"
"- 0: not a manifest\n"
"- 1: DASH manifest\n"
"- 2: HLS manifest\n"
Expand Down
3 changes: 3 additions & 0 deletions src/filters/dasher.c
Expand Up @@ -1068,6 +1068,9 @@ static GF_Err dasher_configure_pid(GF_Filter *filter, GF_FilterPid *pid, Bool is
gf_filter_pid_set_name(opid, "manifest_mpd" );
manifest_type = 1;
}
if (!gf_sys_is_test_mode() && (ctx->dmode>=GF_DASH_DYNAMIC))
manifest_type |= 0x80000000;

gf_filter_pid_set_property(opid, GF_PROP_PID_IS_MANIFEST, &PROP_UINT(manifest_type));
}

Expand Down
17 changes: 14 additions & 3 deletions src/filters/dmx_dash.c
Expand Up @@ -2,7 +2,7 @@
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2017-2023
* Copyright (c) Telecom ParisTech 2017-2024
* All rights reserved
*
* This file is part of GPAC / DASH/HLS demux filter
Expand Down Expand Up @@ -1007,6 +1007,13 @@ void dashdmx_io_manifest_updated(GF_DASHFileIO *dashio, const char *manifest_nam
}

if ((ctx->forward==DFWD_FILE) && ctx->output_mpd_pid) {
//for routeout
u32 manifest_type = gf_dash_is_m3u8(ctx->dash) ? 2 : 1;
if (!gf_sys_is_test_mode() && gf_dash_is_dynamic_mpd(ctx->dash))
manifest_type |= 0x80000000;

gf_filter_pid_set_property(ctx->output_mpd_pid, GF_PROP_PID_IS_MANIFEST, &PROP_UINT(manifest_type));

GF_FilterPacket *pck = gf_filter_pck_new_alloc(ctx->output_mpd_pid, manifest_payload_len, &output);
if (pck) {
GF_LOG(GF_LOG_INFO, GF_LOG_DASH, ("[DASHDmx] Manifest %s updated, forwarding\n", manifest_name));
Expand Down Expand Up @@ -1636,6 +1643,11 @@ static void dashdmx_declare_properties(GF_DASHDmxCtx *ctx, GF_DASHGroup *group,
) {
stream_type = GF_STREAM_TEXT;
}
if (qinfo.mime) {
if (!strncmp(qinfo.mime, "video/", 6)) stream_type = GF_STREAM_VISUAL;
else if (!strncmp(qinfo.mime, "audio/", 6)) stream_type = GF_STREAM_AUDIO;
if (!strncmp(qinfo.mime, "text/", 5)) stream_type = GF_STREAM_TEXT;
}
dashdm_format_qinfo(&qdesc, &qinfo);

qualities.value.string_list.vals = gf_realloc(qualities.value.string_list.vals, sizeof(char *) * (qualities.value.string_list.nb_items+1));
Expand Down Expand Up @@ -1965,8 +1977,6 @@ static GF_Err dashdmx_configure_pid(GF_Filter *filter, GF_FilterPid *pid, Bool i
GF_LOG(GF_LOG_INFO, GF_LOG_DASH, ("[DASHDmx] Creating manifest output PID\n"));
//for routeout
gf_filter_pid_set_property(ctx->output_mpd_pid, GF_PROP_PID_PREMUX_STREAM_TYPE, &PROP_UINT(GF_STREAM_FILE));
u32 manifest_type = gf_dash_is_m3u8(ctx->dash) ? 2 : 1;
gf_filter_pid_set_property(ctx->output_mpd_pid, GF_PROP_PID_IS_MANIFEST, &PROP_UINT(manifest_type));
}


Expand All @@ -1976,6 +1986,7 @@ static GF_Err dashdmx_configure_pid(GF_Filter *filter, GF_FilterPid *pid, Bool i
gf_filter_setup_failure(filter, e);
return e;
}

frag = strchr(p->value.string, '#');
if (frag) {
if (ctx->frag_url) gf_free(ctx->frag_url);
Expand Down
9 changes: 8 additions & 1 deletion src/filters/out_route.c
Expand Up @@ -2,7 +2,7 @@
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2020-2023
* Copyright (c) Telecom ParisTech 2020-2024
* All rights reserved
*
* This file is part of GPAC / ROUTE output filter
Expand Down Expand Up @@ -387,6 +387,13 @@ static GF_Err routeout_configure_pid(GF_Filter *filter, GF_FilterPid *pid, Bool
manifest_type = 0;
}
}
if (manifest_type) {
if (manifest_type & 0x80000000) {
manifest_type &= 0x7FFFFFFF;
} else {
GF_LOG(GF_LOG_WARNING, GF_LOG_ROUTE, ("[ROUTE] Manifest file describes a static session, clients tune-in will likely fail !\n"));
}
}

if (!rserv) {
GF_Err e;
Expand Down
12 changes: 10 additions & 2 deletions src/media_tools/dash_client.c
Expand Up @@ -2,7 +2,7 @@
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre, Cyril Concolato
* Copyright (c) Telecom ParisTech 2010-2023
* Copyright (c) Telecom ParisTech 2010-2024
* All rights reserved
*
* This file is part of GPAC / Adaptive HTTP Streaming
Expand Down Expand Up @@ -10150,11 +10150,19 @@ u32 gf_dash_group_get_audio_channels(GF_DashClient *dash, u32 idx)
u32 i=0;
GF_DASH_Group *group = gf_list_get(dash->groups, idx);
if (!group) return 0;
GF_List *l = group->adaptation_set->audio_channels;
if (!gf_list_count(l)) {
GF_MPD_Representation *rep = gf_list_get(group->adaptation_set->representations, 0);
if (rep && rep->audio_channels) l = rep->audio_channels;
}

while ((mpd_desc=gf_list_enum(group->adaptation_set->audio_channels, &i))) {
while ((mpd_desc=gf_list_enum(l, &i))) {
if (!strcmp(mpd_desc->scheme_id_uri, "urn:mpeg:dash:23003:3:audio_channel_configuration:2011")) {
return atoi(mpd_desc->value);
}
if (!strcmp(mpd_desc->scheme_id_uri, "urn:mpeg:mpegB:cicp:ChannelConfiguration")) {
return gf_audio_fmt_get_num_channels_from_layout( gf_audio_fmt_get_layout_from_cicp(atoi(mpd_desc->value)));
}
}
return 0;
}
Expand Down

0 comments on commit 61146d5

Please sign in to comment.