-
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
Run MistInHLS mist binary on push end for each rendition #55
Conversation
Add subprocess/logging.go
func streamOutput(src io.Reader, dst *bytes.Buffer, out io.Writer) error { | ||
mw := io.MultiWriter(dst, out) | ||
s := bufio.NewReader(src) | ||
for { | ||
var line []byte | ||
line, err := s.ReadSlice('\n') | ||
if err == io.EOF && len(line) == 0 { | ||
break | ||
} | ||
if err == io.EOF { | ||
return fmt.Errorf("Improper termination: %v", line) | ||
} | ||
if err != nil { | ||
return err | ||
} | ||
_, err = mw.Write(line) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
return 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.
@emranemran moved this to logging.go
. Please check for sanity. Removed multiwriter - deemed unnecessary
Codecov Report
@@ Coverage Diff @@
## main #55 +/- ##
===================================================
+ Coverage 34.88152% 35.28284% +0.40131%
===================================================
Files 17 17
Lines 1055 1043 -12
===================================================
Hits 368 368
+ Misses 642 630 -12
Partials 45 45
Continue to review full report at Codecov.
|
@@ -63,7 +66,7 @@ func (d *MistCallbackHandlersCollection) TranscodingPushEnd(w http.ResponseWrite | |||
return | |||
} | |||
|
|||
uploadSuccess := pushStatus == "null" | |||
uploadSuccess := pushStatus != "null" |
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.
Testing shows we actually get null
on error and json object on success.
handlers/misttriggers/push_end.go
Outdated
@@ -76,6 +79,10 @@ func (d *MistCallbackHandlersCollection) TranscodingPushEnd(w http.ResponseWrite | |||
} | |||
} | |||
|
|||
if err := createDtsh(actualDestination); err != nil { | |||
_ = config.Logger.Log("msg", "createDtsh failed", "err", err) |
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.
Could we have more context (e.g IDs) on this log line to help identify what it failed for?
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.
Adding actualDestination
to that log line
@@ -143,3 +150,24 @@ func uuidFromPushUrl(uri string) (string, error) { | |||
} | |||
return path[len(path)-2], nil | |||
} | |||
|
|||
func createDtsh(destination string) error { |
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.
Could you add a unit test for this method?
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 idea
Config
config.PathMistDir
now contains path to MistServer binaries directory. We use this info to construct absolute path toMistProcLivepeer
andMistInHLS
.MistInHLS
is used to create.dtsh
headers file alongside playlist and segments created on s3.DDVTECH/mistserver#117 is created for tracking MistServer issue that will obsolete this extra step of running
MistInHLS
.Add subprocess/logging.go