From 2687b95d5830179c53914a7e903ecfbaced429cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Thu, 24 Feb 2022 22:27:18 +0100 Subject: [PATCH] fix(cea): make a more robust CEA MP4 parser (#3965) Fix a HLS error reported in https://github.com/google/shaka-player/issues/2337#issuecomment-1040389975 Tested with https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_adv_example_hevc/master.m3u8 --- lib/cea/mp4_cea_parser.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/cea/mp4_cea_parser.js b/lib/cea/mp4_cea_parser.js index 915205a915..fce47c71be 100644 --- a/lib/cea/mp4_cea_parser.js +++ b/lib/cea/mp4_cea_parser.js @@ -236,7 +236,13 @@ shaka.cea.Mp4CeaParser = class { }); } } else { - reader.skip(naluSize - 1); + try { + reader.skip(naluSize - 1); + } catch (e) { + // It is necessary to ignore this error because it can break the start + // of playback even if the user does not want to see the subtitles. + break; + } } sampleSize -= (naluSize + 4); if (sampleSize == 0) {