wrap some encode errors

This commit is contained in:
sentriz
2020-02-20 18:11:30 +00:00
committed by Serge Tkatchouk
parent c79524e44e
commit 0733117aed
2 changed files with 16 additions and 15 deletions

View File

@@ -116,11 +116,14 @@ func (c *Controller) ServeStream(w http.ResponseWriter, r *http.Request) *spec.R
if fileExists(cacheFile) {
log.Printf("cache [%s/%s] hit!\n", profile.Format, bitrate)
http.ServeFile(w, r, cacheFile)
return
return nil
}
log.Printf("cache [%s/%s] miss!\n", profile.Format, bitrate)
if err := encode.Encode(w, absPath, cacheFile, profile, bitrate); err != nil {
log.Printf("cache [%s/%s] miss!\n", profile.Format, bitrate)
log.Printf("error encoding %q: %v\n", absPath, err)
}
log.Printf("track `%s` encoded to [%s/%s] successfully\n",
track.Filename, profile.Format, profile.Bitrate)
return nil
}