-
Notifications
You must be signed in to change notification settings - Fork 2
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
upload: generate dtsh before segmenting input file #177
Conversation
After a push request is sent, Mist attempt to read the input file, generate the dtsh header if there is none, and then begin segmenting the fil. For certain files (typically large in size), the segmenting step would fail and generate an single empty 0.ts segment before bailing. This change attempts to workaround this raciness within Mist by attempting to create the dtsh using an out-of-band call to MistInMP4 before segmenting begins.
handlers/upload.go
Outdated
return err | ||
} | ||
go func() { | ||
if err := headerPrepare.Wait(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we do the Wait()
in an async function? Don't we need to wait for it to finish to get the benefits of the DTSH file being there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! My mistake from time when dtsh was being created after transcode response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, good catch - missed this as well.
// prepare .dtsh headers for all rendition playlists | ||
for _, output := range outputs { | ||
// output is multivariant playlist | ||
err := createDtsh(requestID, output.Manifest) | ||
if err != nil { | ||
// should not block the ingestion flow or make it fail on error. | ||
log.LogError(requestID, "master createDtsh() failed", err, "destination", output.Manifest) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need this for mist playback. Am i missing some info?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For mist playback we need dtsh of multivariant playlist, rendition's dtsh is not used in mistserver playback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: MistInHLS needs to be fixed - dtsh for playlist is still broken which is why i removed it originally. Following up here: #178
handlers/upload.go
Outdated
go func() { | ||
if err := headerPrepare.Wait(); err != nil { | ||
log.LogError(requestID, "createDtsh return code", err, "destination", destination) | ||
} | ||
}() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go func() { | |
if err := headerPrepare.Wait(); err != nil { | |
log.LogError(requestID, "createDtsh return code", err, "destination", destination) | |
} | |
}() | |
if err := headerPrepare.Wait(); err != nil { | |
log.LogError(requestID, "createDtsh return code", err, "destination", destination) | |
} |
Codecov Report
@@ Coverage Diff @@
## main #177 +/- ##
===================================================
- Coverage 48.36521% 47.49389% -0.87132%
===================================================
Files 24 24
Lines 1621 1636 +15
===================================================
- Hits 784 777 -7
- Misses 741 765 +24
+ Partials 96 94 -2
Continue to review full report at Codecov.
|
// Once we're happy with the request, do the rest of the Segmenting stage asynchronously to allow us to | ||
// from the API call and free up the HTTP connection | ||
go func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smart choice
After a push request is sent, Mist attempt to read the input file, generate the dtsh header if there is none, and then begin segmenting the file. For certain files (typically large in size), the segmenting step would fail and generate an single empty 0.ts segment before bailing.
This change attempts to workaround this raciness within Mist by attempting to create the dtsh using an out-of-band call to MistInMP4 before segmenting begins.
Note: requires fix from mist repo for MistInMP4 to work as expected:
DDVTECH/mistserver#131