Prevent error logs when aborting a stream
This commit is contained in:
parent
14f7ad399f
commit
39d117a47d
|
@ -73,6 +73,8 @@ class MuxingSession extends EventEmitter {
|
||||||
private tsWatcher: FSWatcher
|
private tsWatcher: FSWatcher
|
||||||
private masterWatcher: FSWatcher
|
private masterWatcher: FSWatcher
|
||||||
|
|
||||||
|
private aborted = false
|
||||||
|
|
||||||
private readonly isAbleToUploadVideoWithCache = memoizee((userId: number) => {
|
private readonly isAbleToUploadVideoWithCache = memoizee((userId: number) => {
|
||||||
return isAbleToUploadVideo(userId, 1000)
|
return isAbleToUploadVideo(userId, 1000)
|
||||||
}, { maxAge: MEMOIZE_TTL.LIVE_ABLE_TO_UPLOAD })
|
}, { maxAge: MEMOIZE_TTL.LIVE_ABLE_TO_UPLOAD })
|
||||||
|
@ -176,6 +178,7 @@ class MuxingSession extends EventEmitter {
|
||||||
abort () {
|
abort () {
|
||||||
if (!this.ffmpegCommand) return
|
if (!this.ffmpegCommand) return
|
||||||
|
|
||||||
|
this.aborted = true
|
||||||
this.ffmpegCommand.kill('SIGINT')
|
this.ffmpegCommand.kill('SIGINT')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,6 +249,8 @@ class MuxingSession extends EventEmitter {
|
||||||
const playlistIdMatcher = /^([\d+])-/
|
const playlistIdMatcher = /^([\d+])-/
|
||||||
|
|
||||||
const addHandler = async (segmentPath: string) => {
|
const addHandler = async (segmentPath: string) => {
|
||||||
|
if (this.aborted) return
|
||||||
|
|
||||||
logger.debug('Live add handler of %s.', segmentPath, this.lTags())
|
logger.debug('Live add handler of %s.', segmentPath, this.lTags())
|
||||||
|
|
||||||
const playlistId = basename(segmentPath).match(playlistIdMatcher)[0]
|
const playlistId = basename(segmentPath).match(playlistIdMatcher)[0]
|
||||||
|
@ -332,6 +337,8 @@ class MuxingSession extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private processSegments (segmentPaths: string[]) {
|
private processSegments (segmentPaths: string[]) {
|
||||||
|
if (this.aborted) return
|
||||||
|
|
||||||
mapSeries(segmentPaths, async previousSegment => {
|
mapSeries(segmentPaths, async previousSegment => {
|
||||||
// Add sha hash of previous segments, because ffmpeg should have finished generating them
|
// Add sha hash of previous segments, because ffmpeg should have finished generating them
|
||||||
await LiveSegmentShaStore.Instance.addSegmentSha(this.videoUUID, previousSegment)
|
await LiveSegmentShaStore.Instance.addSegmentSha(this.videoUUID, previousSegment)
|
||||||
|
|
Loading…
Reference in New Issue