From b776a4868ff54bc99764d0b7008fffa456c4a064 Mon Sep 17 00:00:00 2001 From: killer069 <65385476+killer069@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:55:45 +0530 Subject: [PATCH] LiveStream Memory issue fix --- play-dl/YouTube/classes/LiveStream.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/play-dl/YouTube/classes/LiveStream.ts b/play-dl/YouTube/classes/LiveStream.ts index 2b59de1..84b49c3 100644 --- a/play-dl/YouTube/classes/LiveStream.ts +++ b/play-dl/YouTube/classes/LiveStream.ts @@ -34,7 +34,10 @@ export class LiveStreaming{ } private async live_loop(){ - if(this.stream.destroyed) this.cleanup() + if(this.stream.destroyed) { + this.cleanup() + return + } await this.manifest_getter() this.segments_urls.splice(0, (this.segments_urls.length / 2)) if(this.packet_count === 0) this.packet_count = Number(this.segments_urls[0].split('index.m3u8/sq/')[1].split('/')[0]) @@ -61,7 +64,10 @@ export class LiveStreaming{ } private async looping(){ - if(this.stream.destroyed) this.cleanup() + if(this.stream.destroyed){ + this.cleanup() + return + } await this.manifest_getter() for await (let url of this.segments_urls){ await (async () => { @@ -97,7 +103,10 @@ export class LiveStreaming{ } private async start(){ - if(this.stream.destroyed) this.cleanup() + if(this.stream.destroyed){ + this.cleanup() + return + } await this.manifest_getter() if(this.packet_count === 0) this.packet_count = Number(this.segments_urls[0].split('index.m3u8/sq/')[1].split('/')[0]) for await (let url of this.segments_urls){ @@ -156,7 +165,10 @@ export class LiveEnded{ } async start(){ - if(this.stream.destroyed) this.cleanup() + if(this.stream.destroyed){ + this.cleanup() + return + } await this.manifest_getter() if(this.packet_count === 0) this.packet_count = Number(this.segments_urls[0].split('index.m3u8/sq/')[1].split('/')[0]) for await (let url of this.segments_urls){