Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSVAMB-69845: [Dreamforce 2024][ESTT] Buffering and Errors on Live Streams During Extended Streaming-Time Test #215

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

igorshevach
Copy link
Contributor

@igorshevach igorshevach commented Sep 17, 2024

issue:

A transcoder as a micro-service does not handle codec changes.
therefore, transcoding fails once codec change is detected (KMP_MEDIA_INFO_PACKET is received).
This cause stream to stuck since downstream KMP node would not get last ack until upstream KMP node sends one, and segmenter won't send one until specific segment is ready to be persisted.
In the meanwhile, transcoder gets re-created and old media info segment is re-played over and over again, causing waste of system resources, keeping transcoder fail over and over again.

solution

The quick and dirty fix is for transcoder recognize the need to skip over last media info segment and send an ack downstream without waiting for upstream to send an ack - which will resolve the issue immediately.
Once the last segment is confirmed, transcoder starts with new segment after a single restart.

downsides

While this solves the issue we have control no more over remaining segment since we give up on acking the rest of segment in favor of new one (segment means here collection of frames using same media info).

special issues

I had to modify init logic in transcoder because after a restart, both old & new media types are pushed to transcoder, making it impossible to do a codec change. the modification is to wait until first media frame, so that media info be the most updated one. I could not easily solve the issue since media info does not bears an id, so it cannot be ack'ed like frames do. perhaps adding acks to media info would make passing around media info more robust. :(

misc

an rtmp file dump, video only ,used with automated tools, having codec change (480p and 720p) in a loop

@@ -1238,6 +1293,8 @@ ngx_kmp_out_track_write_media_info(ngx_kmp_out_track_t *track)
return NGX_ERROR;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want to log before the other calls in the function in case one fails?

@@ -1464,13 +1465,23 @@ ngx_rtmp_codec_postconfiguration(ngx_conf_t *cf)
return NGX_ERROR;
}

nelts = cmcf->events[NGX_RTMP_MSG_AUDIO].nelts;
for ( ; nelts > 1; nelts--, h--) {
*h = h[-1];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no leak here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants