From fb7e2347e9624bd50a307eb983a583a96e3396e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=CC=81lvaro=20Velad=20Galva=CC=81n?= Date: Tue, 26 Nov 2024 10:12:27 +0100 Subject: [PATCH 1/2] fix(HLS): Ignore errors when try to detect CC --- lib/media/segment_utils.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/media/segment_utils.js b/lib/media/segment_utils.js index b2dd393f23..d0179853e3 100644 --- a/lib/media/segment_utils.js +++ b/lib/media/segment_utils.js @@ -417,9 +417,13 @@ shaka.media.SegmentUtils = class { if (initData) { captionParser.init(initData); } - captionParser.parseFrom(data); - for (const stream of captionParser.getStreams()) { - closedCaptions.set(stream, stream); + try { + captionParser.parseFrom(data); + for (const stream of captionParser.getStreams()) { + closedCaptions.set(stream, stream); + } + } catch (e) { + // Ignore errors. } captionParser.reset(); } From 3db9358ba1206e50c5d373b1ad72f78cc2b5da11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=CC=81lvaro=20Velad=20Galva=CC=81n?= Date: Tue, 26 Nov 2024 11:55:14 +0100 Subject: [PATCH 2/2] Add log --- lib/media/segment_utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/media/segment_utils.js b/lib/media/segment_utils.js index d0179853e3..3cdb4319ed 100644 --- a/lib/media/segment_utils.js +++ b/lib/media/segment_utils.js @@ -423,7 +423,7 @@ shaka.media.SegmentUtils = class { closedCaptions.set(stream, stream); } } catch (e) { - // Ignore errors. + shaka.log.debug('Error detecting CC streams', e); } captionParser.reset(); }