mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-02 12:03:45 +02:00
revert variant playlist code
This commit is contained in:
parent
59c2454b23
commit
d743c36996
|
@ -381,34 +381,6 @@ ngx_module_t ngx_rtmp_hls_module = {
|
|||
NGX_MODULE_V1_PADDING
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
static ngx_rtmp_codec_ctx_t * ngx_rtmp_hls_get_stream(ngx_rtmp_session_t *s, u_char *name)
|
||||
{
|
||||
ngx_rtmp_core_app_conf_t *cacf;
|
||||
ngx_rtmp_live_app_conf_t *lacf;
|
||||
ngx_int_t n;
|
||||
ngx_rtmp_live_stream_t *stream;
|
||||
ngx_rtmp_live_ctx_t *ctx;
|
||||
|
||||
cacf = *s->app_conf;
|
||||
lacf = cacf->app_conf[ngx_rtmp_live_module.ctx_index];
|
||||
|
||||
for (n = 0; n < lacf->nbuckets; ++n) {
|
||||
for (stream = lacf->streams[n]; stream; stream = stream->next) {
|
||||
if (ngx_strcmp(name, stream->name) == 0) {
|
||||
for (ctx = stream->ctx; ctx; ctx = ctx->next) {
|
||||
if (ctx->publishing) {
|
||||
return ngx_rtmp_get_module_ctx(ctx->session, ngx_rtmp_codec_module);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
=======
|
||||
>>>>>>> parent of 7b7d30f... Intellegent variant playlist entries. Auto stream inf, skip if not live
|
||||
|
||||
static ngx_rtmp_hls_frag_t *
|
||||
ngx_rtmp_hls_get_frag(ngx_rtmp_session_t *s, ngx_int_t n)
|
||||
|
@ -503,55 +475,9 @@ ngx_rtmp_hls_write_variant_playlist(ngx_rtmp_session_t *s)
|
|||
|
||||
p = ngx_slprintf(p, last, "#EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE");
|
||||
|
||||
<<<<<<< HEAD
|
||||
// not sure why this is necessary. snprintf wasn't null terminating
|
||||
ngx_memzero(variant_name, NGX_RTMP_MAX_NAME);
|
||||
|
||||
ngx_snprintf(variant_name, NGX_RTMP_MAX_NAME, "%*s%V",
|
||||
ctx->name.len - ctx->var->suffix.len, ctx->name.data,
|
||||
&var->suffix);
|
||||
|
||||
if(var->args.nelts == 0) {
|
||||
if (ngx_strcmp(ctx->name.data, variant_name) == 0) {
|
||||
codec_ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_codec_module);
|
||||
}
|
||||
else {
|
||||
codec_ctx = ngx_rtmp_hls_get_stream(s, variant_name);
|
||||
}
|
||||
|
||||
if(codec_ctx) {
|
||||
// meta bandwidth is in kbps, output is in bps. Add 10% overhead
|
||||
total_data_rate = (codec_ctx->video_data_rate + codec_ctx->audio_data_rate)*1100;
|
||||
p = ngx_slprintf(p, last, ",BANDWIDTH=%.0f", total_data_rate);
|
||||
if(codec_ctx->width) {
|
||||
p = ngx_slprintf(p, last, ",CODECS=\"avc1.%02uxi%02uxi%02uxi", codec_ctx->avc_profile, codec_ctx->avc_compat, codec_ctx->avc_level);
|
||||
if(codec_ctx->audio_codec_id) {
|
||||
// apple says mp4a.40.34 for mp3. Other sources say mp4a.6b or mp4a.69
|
||||
// https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/FrequentlyAskedQuestions/FrequentlyAskedQuestions.html
|
||||
// nginx-rtmp dash module uses 6b.
|
||||
p = ngx_slprintf(p, last, ",mp4a.%s\"", codec_ctx->audio_codec_id == NGX_RTMP_AUDIO_AAC ?
|
||||
(codec_ctx->aac_sbr ? "40.5" : "40.2") : "40.34");
|
||||
}
|
||||
else *p++ = '"';
|
||||
p = ngx_slprintf(p, last, ",RESOLUTION=%uix%ui", codec_ctx->width, codec_ctx->height);
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
// skip the non-broadcasting rendition
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
arg = var->args.elts;
|
||||
for (k = 0; k < var->args.nelts; k++, arg++) {
|
||||
p = ngx_slprintf(p, last, ",%V", arg);
|
||||
}
|
||||
=======
|
||||
arg = var->args.elts;
|
||||
for (k = 0; k < var->args.nelts; k++, arg++) {
|
||||
p = ngx_slprintf(p, last, ",%V", arg);
|
||||
>>>>>>> parent of 7b7d30f... Intellegent variant playlist entries. Auto stream inf, skip if not live
|
||||
}
|
||||
|
||||
if (p < last) {
|
||||
|
|
Loading…
Reference in a new issue