ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix broken ending live
Chocobozzz0b603c0062f7
diff --git a/packages/tests/src/api/live/live-constraints.ts b/packages/tests/src/api/live/live-constraints.tsindex 1890344602..34867b6be0 100644--- a/packages/tests/src/api/live/live-constraints.ts+++ b/packages/tests/src/api/live/live-constraints.ts@@ -50,11 +50,19 @@ describe('Test live constraints', function () {await checkLiveCleanup({ server: servers[0], permanent: false, videoUUID: videoId, savedResolutions })}- function updateQuota (options: { total: number, daily: number }) {+ async function increaseQuota (options: { total: number, daily: number }) {+ const current = await servers[0].users.getMyQuotaUsed({ token: userAccessToken })+return servers[0].users.update({userId,- videoQuota: options.total,- videoQuotaDaily: options.daily++ videoQuota: options.total !== -1+ ? current.videoQuotaUsed + options.total+ : options.total,++ videoQuotaDaily: options.daily !== -1+ ? current.videoQuotaUsedDaily + options.daily+ : options.daily})}@@ -75,8 +83,6 @@ describe('Test live constraints', function () {userId = res.userIduserChannelId = res.userChannelIduserAccessToken = res.token-- await updateQuota({ total: 1, daily: -1 })}editorToken = await servers[0].channelCollaborators.createEditor('editor', 'user1_channel')@@ -88,6 +94,8 @@ describe('Test live constraints', function () {it('Should not have size limit if save replay is disabled', async function () {this.timeout(60000)+ await increaseQuota({ total: 5000, daily: -1 })+const userVideoLiveId = await createLiveWrapper({ replay: false, permanent: false })await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveId, shouldHaveError: false })})@@ -98,6 +106,8 @@ describe('Test live constraints', function () {// Wait for user quota memoize cache invalidationawait wait(5000)+ await increaseQuota({ total: 5000, daily: -1 })+const userVideoLiveId = await createLiveWrapper({ replay: true, permanent: false })await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveId, shouldHaveError: true })@@ -116,6 +126,8 @@ describe('Test live constraints', function () {// Wait for user quota memoize cache invalidationawait wait(5000)+ await increaseQuota({ total: 5000, daily: -1 })+const userVideoLiveId = await createLiveWrapper({ replay: true, permanent: true })await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveId, shouldHaveError: true })@@ -132,7 +144,7 @@ describe('Test live constraints', function () {// Wait for user quota memoize cache invalidationawait wait(5000)- await updateQuota({ total: -1, daily: 1 })+ await increaseQuota({ total: -1, daily: 5000 })const userVideoLiveId = await createLiveWrapper({ replay: true, permanent: false, token: editorToken })await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveId, shouldHaveError: true })@@ -152,7 +164,7 @@ describe('Test live constraints', function () {// Wait for user quota memoize cache invalidationawait wait(5000)- await updateQuota({ total: 10 * 1000 * 1000, daily: -1 })+ await increaseQuota({ total: 10 * 1000 * 1000, daily: -1 })const userVideoLiveId = await createLiveWrapper({ replay: true, permanent: false })await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveId, shouldHaveError: false })@@ -198,6 +210,8 @@ describe('Test live constraints', function () {it('Should have max duration limit', async function () {this.timeout(240000)+ await increaseQuota({ total: -1, daily: -1 })+await servers[0].config.updateExistingConfig({newConfig: {live: {diff --git a/server/core/lib/live/live-segment-sha-store.ts b/server/core/lib/live/live-segment-sha-store.tsindex 3f899f7e49..a3b0cc7712 100644--- a/server/core/lib/live/live-segment-sha-store.ts+++ b/server/core/lib/live/live-segment-sha-store.ts@@ -38,11 +38,6 @@ class LiveSegmentShaStore {this.sendToObjectStorage = options.sendToObjectStorage}- abort () {- this.writeQueue.pause()- this.writeQueue.clear()- }-async addSegmentSha (segmentPath: string) {logger.debug('Adding live sha segment %s.', segmentPath, lTags(this.videoUUID))diff --git a/server/core/lib/live/shared/muxing-session.ts b/server/core/lib/live/shared/muxing-session.tsindex 161e2fd602..8a5be65c67 100644--- a/server/core/lib/live/shared/muxing-session.ts+++ b/server/core/lib/live/shared/muxing-session.ts@@ -202,8 +202,6 @@ class MuxingSession extends EventEmitter implements MuxingSession {this.aborted = truethis.transcodingWrapper.abort()-- if (this.liveSegmentShaStore) this.liveSegmentShaStore.abort()}destroy () {