rx-player 4.5.0-dev.2026031700 → 4.5.0-dev.2026033100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -1
- package/VERSION +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/commonjs/compat/browser_compatibility_types.d.ts +16 -14
- package/dist/commonjs/compat/browser_compatibility_types.d.ts.map +1 -1
- package/dist/commonjs/compat/browser_compatibility_types.js +7 -4
- package/dist/commonjs/compat/browser_version.d.ts +2 -1
- package/dist/commonjs/compat/browser_version.d.ts.map +1 -1
- package/dist/commonjs/compat/browser_version.js +13 -0
- package/dist/commonjs/compat/disable_remote_playback_on_managed_media_source.d.ts.map +1 -1
- package/dist/commonjs/compat/disable_remote_playback_on_managed_media_source.js +1 -1
- package/dist/commonjs/compat/is_codec_supported.d.ts.map +1 -1
- package/dist/commonjs/compat/is_codec_supported.js +4 -3
- package/dist/commonjs/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts +26 -0
- package/dist/commonjs/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts.map +1 -0
- package/dist/commonjs/compat/should_patch_out_dolby_vision_config_data_from_mp4.js +45 -0
- package/dist/commonjs/core/entry/utils.js +3 -3
- package/dist/commonjs/core/fetchers/segment/segment_fetcher.d.ts.map +1 -1
- package/dist/commonjs/core/fetchers/segment/segment_fetcher.js +2 -1
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +2 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +8 -6
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +4 -3
- package/dist/commonjs/initialize_worker.js +1 -1
- package/dist/commonjs/main_thread/api/debug/modules/segment_buffer_content.js +3 -3
- package/dist/commonjs/main_thread/api/public_api.js +2 -2
- package/dist/commonjs/main_thread/init/utils/update_manifest_codec_support.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/utils/update_manifest_codec_support.js +24 -12
- package/dist/commonjs/manifest/classes/adaptation.d.ts.map +1 -1
- package/dist/commonjs/manifest/classes/adaptation.js +3 -1
- package/dist/commonjs/manifest/classes/representation.d.ts +6 -2
- package/dist/commonjs/manifest/classes/representation.d.ts.map +1 -1
- package/dist/commonjs/manifest/classes/representation.js +45 -23
- package/dist/commonjs/manifest/types.d.ts +14 -6
- package/dist/commonjs/manifest/types.d.ts.map +1 -1
- package/dist/commonjs/manifest/utils.js +4 -4
- package/dist/commonjs/mse/main_media_source_interface.d.ts.map +1 -1
- package/dist/commonjs/mse/main_media_source_interface.js +3 -2
- package/dist/commonjs/mse/worker_media_source_interface.d.ts.map +1 -1
- package/dist/commonjs/parsers/containers/isobmff/get_box.d.ts +12 -1
- package/dist/commonjs/parsers/containers/isobmff/get_box.d.ts.map +1 -1
- package/dist/commonjs/parsers/containers/isobmff/get_box.js +16 -0
- package/dist/commonjs/parsers/containers/isobmff/index.d.ts +2 -1
- package/dist/commonjs/parsers/containers/isobmff/index.d.ts.map +1 -1
- package/dist/commonjs/parsers/containers/isobmff/index.js +3 -1
- package/dist/commonjs/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts +13 -0
- package/dist/commonjs/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts.map +1 -0
- package/dist/commonjs/parsers/containers/isobmff/remove_dolby_vision_config_data.js +180 -0
- package/dist/commonjs/parsers/manifest/metaplaylist/metaplaylist_parser.js +4 -4
- package/dist/commonjs/transports/dash/segment_parser.d.ts.map +1 -1
- package/dist/commonjs/transports/dash/segment_parser.js +6 -0
- package/dist/commonjs/transports/dash/text_parser.d.ts.map +1 -1
- package/dist/commonjs/transports/dash/text_parser.js +5 -1
- package/dist/commonjs/transports/local/text_parser.d.ts.map +1 -1
- package/dist/commonjs/transports/local/text_parser.js +5 -1
- package/dist/commonjs/transports/metaplaylist/pipelines.d.ts.map +1 -1
- package/dist/commonjs/transports/metaplaylist/pipelines.js +2 -1
- package/dist/commonjs/transports/smooth/pipelines.js +3 -3
- package/dist/commonjs/transports/types.d.ts +28 -2
- package/dist/commonjs/transports/types.d.ts.map +1 -1
- package/dist/commonjs/transports/utils/parse_text_track.d.ts +9 -2
- package/dist/commonjs/transports/utils/parse_text_track.d.ts.map +1 -1
- package/dist/commonjs/transports/utils/parse_text_track.js +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/es2017/compat/browser_compatibility_types.d.ts +16 -14
- package/dist/es2017/compat/browser_compatibility_types.d.ts.map +1 -1
- package/dist/es2017/compat/browser_compatibility_types.js +7 -1
- package/dist/es2017/compat/browser_version.d.ts +2 -1
- package/dist/es2017/compat/browser_version.d.ts.map +1 -1
- package/dist/es2017/compat/browser_version.js +13 -1
- package/dist/es2017/compat/disable_remote_playback_on_managed_media_source.d.ts.map +1 -1
- package/dist/es2017/compat/disable_remote_playback_on_managed_media_source.js +2 -2
- package/dist/es2017/compat/is_codec_supported.d.ts.map +1 -1
- package/dist/es2017/compat/is_codec_supported.js +2 -1
- package/dist/es2017/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts +26 -0
- package/dist/es2017/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts.map +1 -0
- package/dist/es2017/compat/should_patch_out_dolby_vision_config_data_from_mp4.js +42 -0
- package/dist/es2017/core/entry/utils.js +4 -4
- package/dist/es2017/core/fetchers/segment/segment_fetcher.d.ts.map +1 -1
- package/dist/es2017/core/fetchers/segment/segment_fetcher.js +2 -1
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +2 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +3 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +2 -1
- package/dist/es2017/initialize_worker.js +1 -1
- package/dist/es2017/main_thread/api/debug/modules/segment_buffer_content.js +3 -3
- package/dist/es2017/main_thread/api/public_api.js +2 -2
- package/dist/es2017/main_thread/init/utils/update_manifest_codec_support.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/utils/update_manifest_codec_support.js +9 -7
- package/dist/es2017/manifest/classes/adaptation.d.ts.map +1 -1
- package/dist/es2017/manifest/classes/adaptation.js +3 -1
- package/dist/es2017/manifest/classes/representation.d.ts +6 -2
- package/dist/es2017/manifest/classes/representation.d.ts.map +1 -1
- package/dist/es2017/manifest/classes/representation.js +45 -23
- package/dist/es2017/manifest/types.d.ts +14 -6
- package/dist/es2017/manifest/types.d.ts.map +1 -1
- package/dist/es2017/manifest/utils.js +4 -4
- package/dist/es2017/mse/main_media_source_interface.d.ts.map +1 -1
- package/dist/es2017/mse/main_media_source_interface.js +2 -1
- package/dist/es2017/mse/worker_media_source_interface.d.ts.map +1 -1
- package/dist/es2017/parsers/containers/isobmff/get_box.d.ts +12 -1
- package/dist/es2017/parsers/containers/isobmff/get_box.d.ts.map +1 -1
- package/dist/es2017/parsers/containers/isobmff/get_box.js +16 -1
- package/dist/es2017/parsers/containers/isobmff/index.d.ts +2 -1
- package/dist/es2017/parsers/containers/isobmff/index.d.ts.map +1 -1
- package/dist/es2017/parsers/containers/isobmff/index.js +2 -1
- package/dist/es2017/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts +13 -0
- package/dist/es2017/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts.map +1 -0
- package/dist/es2017/parsers/containers/isobmff/remove_dolby_vision_config_data.js +155 -0
- package/dist/es2017/parsers/manifest/metaplaylist/metaplaylist_parser.js +4 -4
- package/dist/es2017/transports/dash/segment_parser.d.ts.map +1 -1
- package/dist/es2017/transports/dash/segment_parser.js +7 -1
- package/dist/es2017/transports/dash/text_parser.d.ts.map +1 -1
- package/dist/es2017/transports/dash/text_parser.js +5 -1
- package/dist/es2017/transports/local/text_parser.d.ts.map +1 -1
- package/dist/es2017/transports/local/text_parser.js +5 -1
- package/dist/es2017/transports/metaplaylist/pipelines.d.ts.map +1 -1
- package/dist/es2017/transports/metaplaylist/pipelines.js +2 -1
- package/dist/es2017/transports/smooth/pipelines.js +3 -3
- package/dist/es2017/transports/types.d.ts +28 -2
- package/dist/es2017/transports/types.d.ts.map +1 -1
- package/dist/es2017/transports/utils/parse_text_track.d.ts +9 -2
- package/dist/es2017/transports/utils/parse_text_track.d.ts.map +1 -1
- package/dist/es2017/transports/utils/parse_text_track.js +1 -1
- package/dist/worker.js +6 -6
- package/eslint.config.mjs +1 -14
- package/package.json +1 -1
- package/src/__GENERATED_CODE/embedded_worker.ts +1 -1
- package/src/compat/__tests__/browser_compatibility_types.test.ts +15 -26
- package/src/compat/__tests__/browser_version.test.ts +57 -18
- package/src/compat/__tests__/clear_element_src.test.ts +20 -40
- package/src/compat/__tests__/is_codec_supported.test.ts +39 -44
- package/src/compat/__tests__/is_vtt_cue.test.ts +5 -8
- package/src/compat/__tests__/make_vtt_cue.test.ts +20 -31
- package/src/compat/__tests__/remove_cue.test.ts +8 -20
- package/src/compat/__tests__/should_patch_out_dolby_vision_config_data_from_mp4.test.ts +78 -0
- package/src/compat/browser_compatibility_types.ts +8 -1
- package/src/compat/browser_version.ts +17 -1
- package/src/compat/disable_remote_playback_on_managed_media_source.ts +2 -2
- package/src/compat/is_codec_supported.ts +2 -1
- package/src/compat/should_patch_out_dolby_vision_config_data_from_mp4.ts +50 -0
- package/src/core/adaptive/__tests__/adaptive_representation_selector.test.ts +68 -28
- package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +26 -84
- package/src/core/entry/__tests__/utils.test.ts +7 -1
- package/src/core/entry/utils.ts +4 -4
- package/src/core/fetchers/segment/segment_fetcher.ts +2 -1
- package/src/errors/__tests__/format_error.test.ts +23 -24
- package/src/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.ts +2 -1
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/mediaDisplayInfos.test.ts +106 -0
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/HDCPPolicy.test.ts +19 -42
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/decodingInfo.test.ts +33 -40
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/defaultCodecsFinder.test.ts +44 -68
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/mediaContentType.test.ts +45 -80
- package/src/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.ts +3 -1
- package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.ts +2 -1
- package/src/features/__tests__/add_features.test.ts +12 -27
- package/src/initialize_worker.ts +1 -1
- package/src/main_thread/api/__tests__/option_utils.test.ts +38 -67
- package/src/main_thread/api/__tests__/public_api.test.ts +56 -138
- package/src/main_thread/api/debug/modules/segment_buffer_content.ts +3 -3
- package/src/main_thread/api/public_api.ts +2 -2
- package/src/main_thread/decrypt/__tests__/__global__/find_key_system.test.ts +46 -28
- package/src/main_thread/decrypt/__tests__/__global__/get_license.test.ts +40 -10
- package/src/main_thread/decrypt/__tests__/__global__/init_data.test.ts +112 -129
- package/src/main_thread/decrypt/__tests__/__global__/media_key_system_access.test.ts +282 -377
- package/src/main_thread/decrypt/__tests__/__global__/media_keys.test.ts +70 -63
- package/src/main_thread/decrypt/__tests__/__global__/server_certificate.test.ts +73 -54
- package/src/main_thread/decrypt/__tests__/__global__/utils.ts +43 -83
- package/src/main_thread/decrypt/__tests__/find_key_system.test.ts +36 -17
- package/src/main_thread/decrypt/utils/__tests__/clean_old_stored_persistent_info.test.ts +44 -48
- package/src/main_thread/init/utils/__tests__/are_same_stream_events.test.ts +7 -22
- package/src/main_thread/init/utils/__tests__/refresh_scheduled_events_list.test.ts +3 -6
- package/src/main_thread/init/utils/__tests__/update_manifest_codec_support.test.ts +42 -19
- package/src/main_thread/init/utils/update_manifest_codec_support.ts +8 -6
- package/src/manifest/classes/__tests__/adaptation.test.ts +69 -125
- package/src/manifest/classes/__tests__/manifest.test.ts +88 -95
- package/src/manifest/classes/__tests__/period.test.ts +167 -117
- package/src/manifest/classes/__tests__/representation.test.ts +84 -25
- package/src/manifest/classes/__tests__/update_periods.test.ts +96 -225
- package/src/manifest/classes/adaptation.ts +4 -1
- package/src/manifest/classes/representation.ts +59 -27
- package/src/manifest/types.ts +14 -6
- package/src/manifest/utils.ts +4 -4
- package/src/mse/__tests__/main_media_source_interface.test.ts +3 -1
- package/src/mse/__tests__/worker_media_source_interface.test.ts +608 -0
- package/src/mse/main_media_source_interface.ts +2 -1
- package/src/mse/worker_media_source_interface.ts +2 -2
- package/src/parsers/containers/isobmff/__tests__/get_box.test.ts +449 -0
- package/src/parsers/containers/isobmff/__tests__/remove_dolby_vision_config_data.test.ts +282 -0
- package/src/parsers/containers/isobmff/get_box.ts +17 -0
- package/src/parsers/containers/isobmff/index.ts +8 -1
- package/src/parsers/containers/isobmff/remove_dolby_vision_config_data.ts +179 -0
- package/src/parsers/manifest/dash/common/__tests__/get_clock_offset.test.ts +19 -25
- package/src/parsers/manifest/dash/common/__tests__/get_http_utc-timing_url.test.ts +7 -19
- package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/ContentProtection.test.ts +26 -37
- package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/Initialization.test.ts +24 -53
- package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/SegmentURL.test.ts +31 -78
- package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +6 -4
- package/src/parsers/manifest/utils/__tests__/update_segment_timeline.test.ts +79 -87
- package/src/parsers/texttracks/ttml/__tests__/resolve_styles_inheritance.test.ts +20 -26
- package/src/parsers/texttracks/ttml/html/__tests__/__global__/html_ttml_parser.test.ts +2 -7
- package/src/parsers/texttracks/webvtt/__tests__/parse_cue_block.test.ts +33 -30
- package/src/parsers/texttracks/webvtt/__tests__/parse_style_block.test.ts +33 -100
- package/src/parsers/texttracks/webvtt/html/__tests__/convert_payload_to_html.test.ts +16 -18
- package/src/parsers/texttracks/webvtt/html/__tests__/parse_webvtt_to_div.test.ts +73 -78
- package/src/parsers/texttracks/webvtt/html/__tests__/to_html.test.ts +36 -37
- package/src/transports/dash/segment_parser.ts +13 -0
- package/src/transports/dash/text_parser.ts +5 -1
- package/src/transports/local/text_parser.ts +5 -1
- package/src/transports/metaplaylist/pipelines.ts +2 -1
- package/src/transports/smooth/isobmff/__tests__/create_boxes.test.ts +150 -127
- package/src/transports/smooth/pipelines.ts +3 -3
- package/src/transports/types.ts +28 -2
- package/src/transports/utils/__tests__/check_isobmff_integrity.test.ts +49 -75
- package/src/transports/utils/parse_text_track.ts +10 -3
- package/src/utils/__tests__/object_assign.test.ts +2 -2
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from "vitest";
|
|
2
|
+
import shouldPatchOutDolbyVisionConfigDataFromMp4 from "../should_patch_out_dolby_vision_config_data_from_mp4";
|
|
3
|
+
|
|
4
|
+
const mockGetChromeVersion = vi.hoisted(() => vi.fn());
|
|
5
|
+
vi.mock("../browser_version", () => ({
|
|
6
|
+
getChromeVersion: mockGetChromeVersion,
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
describe("compat - shouldPatchOutDolbyVisionConfigDataFromMp4", () => {
|
|
10
|
+
it("should return false if Chrome version is null", () => {
|
|
11
|
+
mockGetChromeVersion.mockReturnValue(null);
|
|
12
|
+
expect(shouldPatchOutDolbyVisionConfigDataFromMp4(["dvh1.something"], "hevc")).toBe(
|
|
13
|
+
false,
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should return false if Chrome version is 94", () => {
|
|
18
|
+
mockGetChromeVersion.mockReturnValue(94);
|
|
19
|
+
expect(shouldPatchOutDolbyVisionConfigDataFromMp4(["dvh1.something"], "hevc")).toBe(
|
|
20
|
+
false,
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("should return false if Chrome version is above 94", () => {
|
|
25
|
+
mockGetChromeVersion.mockReturnValue(120);
|
|
26
|
+
expect(shouldPatchOutDolbyVisionConfigDataFromMp4(["dvh1.something"], "hevc")).toBe(
|
|
27
|
+
false,
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("should return false if no Dolby Vision codec is present in the codecs array", () => {
|
|
32
|
+
mockGetChromeVersion.mockReturnValue(80);
|
|
33
|
+
expect(shouldPatchOutDolbyVisionConfigDataFromMp4(["hevc", "avc1"], "hevc")).toBe(
|
|
34
|
+
false,
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("should return false if the chosen codec is itself a Dolby Vision codec (dvh1)", () => {
|
|
39
|
+
mockGetChromeVersion.mockReturnValue(80);
|
|
40
|
+
expect(
|
|
41
|
+
shouldPatchOutDolbyVisionConfigDataFromMp4(
|
|
42
|
+
["dvh1.something", "hevc"],
|
|
43
|
+
"dvh1.something",
|
|
44
|
+
),
|
|
45
|
+
).toBe(false);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("should return false if the chosen codec is itself a Dolby Vision codec (dvhe)", () => {
|
|
49
|
+
mockGetChromeVersion.mockReturnValue(80);
|
|
50
|
+
expect(
|
|
51
|
+
shouldPatchOutDolbyVisionConfigDataFromMp4(
|
|
52
|
+
["dvhe.something", "hevc"],
|
|
53
|
+
"dvhe.something",
|
|
54
|
+
),
|
|
55
|
+
).toBe(false);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("should return false if chosenCodec is undefined", () => {
|
|
59
|
+
mockGetChromeVersion.mockReturnValue(80);
|
|
60
|
+
expect(
|
|
61
|
+
shouldPatchOutDolbyVisionConfigDataFromMp4(["dvh1.something"], undefined),
|
|
62
|
+
).toBe(false);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("should return true if Chrome version is below 94, codecs contain Dolby Vision, and chosen codec is not Dolby Vision", () => {
|
|
66
|
+
mockGetChromeVersion.mockReturnValue(80);
|
|
67
|
+
expect(
|
|
68
|
+
shouldPatchOutDolbyVisionConfigDataFromMp4(["dvh1.something", "hevc"], "hevc"),
|
|
69
|
+
).toBe(true);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("should return true when Dolby Vision is signaled via dvhe and chosen codec is a retro-compatible one", () => {
|
|
73
|
+
mockGetChromeVersion.mockReturnValue(93);
|
|
74
|
+
expect(
|
|
75
|
+
shouldPatchOutDolbyVisionConfigDataFromMp4(["dvhe.something", "hevc"], "hevc"),
|
|
76
|
+
).toBe(true);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -479,4 +479,11 @@ export type {
|
|
|
479
479
|
ICompatVTTCue,
|
|
480
480
|
ICompatVTTCueConstructor,
|
|
481
481
|
};
|
|
482
|
-
|
|
482
|
+
|
|
483
|
+
/** Various globals in an object so they are easier to mock. */
|
|
484
|
+
const BROWSER_GLOBALS = {
|
|
485
|
+
MediaSource_,
|
|
486
|
+
isManagedMediaSource,
|
|
487
|
+
READY_STATES,
|
|
488
|
+
};
|
|
489
|
+
export default BROWSER_GLOBALS;
|
|
@@ -44,4 +44,20 @@ function getFirefoxVersion(): number | null {
|
|
|
44
44
|
return result;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
function getChromeVersion(): number | null {
|
|
48
|
+
// TODO: Better Chrome detection?
|
|
49
|
+
if (EnvDetector.browser !== EnvDetector.BROWSERS.Other) {
|
|
50
|
+
log.warn(
|
|
51
|
+
"utils",
|
|
52
|
+
"getChromeVersion: Can't access Chrome version. Not a Chrome browser.",
|
|
53
|
+
);
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const match = navigator.userAgent.match(/Chrome\/(\d+)/);
|
|
57
|
+
if (match !== null) {
|
|
58
|
+
return parseInt(match[1], 10);
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { getFirefoxVersion, getChromeVersion };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CancellationSignal } from "../utils/task_canceller";
|
|
2
|
-
import {
|
|
2
|
+
import BROWSER_GLOBALS, { type IMediaElement } from "./browser_compatibility_types";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Temporarily disables remote playback on a media element by setting the
|
|
@@ -19,7 +19,7 @@ export default function disableRemotePlaybackOnManagedMediaSource(
|
|
|
19
19
|
mediaElement: IMediaElement,
|
|
20
20
|
cancellationSignal: CancellationSignal,
|
|
21
21
|
) {
|
|
22
|
-
if (isManagedMediaSource && "disableRemotePlayback" in mediaElement) {
|
|
22
|
+
if (BROWSER_GLOBALS.isManagedMediaSource && "disableRemotePlayback" in mediaElement) {
|
|
23
23
|
const disableRemotePlaybackPreviousValue = mediaElement.disableRemotePlayback;
|
|
24
24
|
cancellationSignal.register(() => {
|
|
25
25
|
/**
|
|
@@ -18,7 +18,7 @@ import type DummyMediaElement from "../experimental/tools/DummyMediaElement";
|
|
|
18
18
|
import log from "../log";
|
|
19
19
|
import isNullOrUndefined from "../utils/is_null_or_undefined";
|
|
20
20
|
import isWorker from "../utils/is_worker";
|
|
21
|
-
import
|
|
21
|
+
import BROWSER_GLOBALS from "./browser_compatibility_types";
|
|
22
22
|
import type { IMediaElement } from "./browser_compatibility_types";
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -53,6 +53,7 @@ export default function isCodecSupported(
|
|
|
53
53
|
mimeType,
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
|
+
const { MediaSource_ } = BROWSER_GLOBALS;
|
|
56
57
|
if (isNullOrUndefined(MediaSource_)) {
|
|
57
58
|
if (isWorker) {
|
|
58
59
|
log.error("mse", "Cannot request codec support in a worker without MSE.");
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import startsWith from "../utils/starts_with";
|
|
2
|
+
import { getChromeVersion } from "./browser_version";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This function returns true if the potential `dvcC` ISOBMFF box should be
|
|
6
|
+
* removed from a segment.
|
|
7
|
+
*
|
|
8
|
+
* Explanation:
|
|
9
|
+
*
|
|
10
|
+
* We had a problem for some years on LG devices with retro-compatible
|
|
11
|
+
* Dolby Vision contents (e.g. which, when Dolby Vision is found to not
|
|
12
|
+
* be compatible to the device, is actually announced as e.g. hevc instead,
|
|
13
|
+
* with the RxPlayer knowing its compatible to both thanks to DASH
|
|
14
|
+
* supplementalCodecs + codecs signaling).
|
|
15
|
+
*
|
|
16
|
+
* Those failed to play, presumably because the device still noticed the
|
|
17
|
+
* Dolby Vision metadata, even though we did not want to play it as Dolby
|
|
18
|
+
* Vision.
|
|
19
|
+
*
|
|
20
|
+
* We found out more recently that this issue has been known by Dolby, seems
|
|
21
|
+
* to affect Chrome version < 94, and even proposed a generic work-around for
|
|
22
|
+
* everybody:
|
|
23
|
+
* https://professionalsupport.dolby.com/s/article/Guidelines-to-developers-building-DASH-HLS-player-apps-for-LG-WebOS-Chromecast-and-other-Chromium-based-app-development-platforms?language=en_US
|
|
24
|
+
*
|
|
25
|
+
* @param {Array.<string>} codecs
|
|
26
|
+
* @returns {Boolean}
|
|
27
|
+
*/
|
|
28
|
+
export default function shouldPatchOutDolbyVisionConfigDataFromMp4(
|
|
29
|
+
codecs: string[],
|
|
30
|
+
chosenCodec: string | undefined,
|
|
31
|
+
): boolean {
|
|
32
|
+
const chromeVersion = getChromeVersion();
|
|
33
|
+
// Seen to affect older LG device with a chrome version inferior to 94
|
|
34
|
+
if (chromeVersion === null || chromeVersion >= 94) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const hasDolbyVision = codecs.some(
|
|
38
|
+
(c) => startsWith(c, "dvh1") || startsWith(c, "dvhe"),
|
|
39
|
+
);
|
|
40
|
+
if (!hasDolbyVision) {
|
|
41
|
+
// NOTE: Technically we could still have a dvcC box here, shouldn't we patch it out
|
|
42
|
+
// regardless when not playing Dolby Vision? I'm unsure...
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return (
|
|
46
|
+
chosenCodec !== undefined &&
|
|
47
|
+
!startsWith(chosenCodec, "dvh1") &&
|
|
48
|
+
!startsWith(chosenCodec, "dvhe")
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -7,7 +7,7 @@ import BufferBasedChooser from "../buffer_based_chooser";
|
|
|
7
7
|
import GuessBasedChooser from "../guess_based_chooser";
|
|
8
8
|
import NetworkAnalyzer from "../network_analyzer";
|
|
9
9
|
// Imported this way to spy on the constructor
|
|
10
|
-
import
|
|
10
|
+
import BandwidthEstimator from "../utils/bandwidth_estimator";
|
|
11
11
|
import PendingRequestsStore from "../utils/pending_requests_store";
|
|
12
12
|
import RepresentationScoreCalculator from "../utils/representation_score_calculator";
|
|
13
13
|
|
|
@@ -79,8 +79,7 @@ describe("createAdaptiveRepresentationSelector", () => {
|
|
|
79
79
|
expect(typeof selector).toBe("function");
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
-
it("
|
|
83
|
-
const MockBandwidthEstimator = vi.spyOn(BandwidthEstimatorModule, "default");
|
|
82
|
+
it("should be instantiable", () => {
|
|
84
83
|
const selector = createAdaptiveRepresentationSelector(makeOptions());
|
|
85
84
|
const rep = makeRepresentation("r1", 500);
|
|
86
85
|
const canceller = new TaskCanceller("test");
|
|
@@ -88,27 +87,33 @@ describe("createAdaptiveRepresentationSelector", () => {
|
|
|
88
87
|
const repsRef = new SharedReference([rep]);
|
|
89
88
|
const obs = makePlaybackObservation({ bufferGap: 0 });
|
|
90
89
|
const observer = makePlaybackObserver(obs);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
const result = selector(
|
|
91
|
+
makeContext(),
|
|
92
|
+
currentRepRef,
|
|
93
|
+
repsRef,
|
|
94
|
+
observer,
|
|
95
|
+
canceller.signal,
|
|
96
|
+
);
|
|
97
|
+
expect(result).not.toBeNull();
|
|
95
98
|
canceller.cancel("done");
|
|
96
|
-
MockBandwidthEstimator.mockRestore();
|
|
97
99
|
});
|
|
98
100
|
|
|
99
101
|
it("reuses the same BandwidthEstimator for the same buffer type across calls", () => {
|
|
100
|
-
const
|
|
102
|
+
const mockAddSample = vi.spyOn(BandwidthEstimator.prototype, "addSample");
|
|
101
103
|
const selector = createAdaptiveRepresentationSelector(makeOptions());
|
|
102
104
|
const rep = makeRepresentation("r1", 500);
|
|
103
105
|
const canceller = new TaskCanceller("test");
|
|
104
|
-
const currentRepRef = new SharedReference(null);
|
|
105
|
-
const repsRef = new SharedReference([rep]);
|
|
106
106
|
const obs = makePlaybackObservation();
|
|
107
|
-
const observer = makePlaybackObserver(obs);
|
|
108
107
|
const ctx = makeContext();
|
|
109
108
|
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
const result1 = selector(
|
|
110
|
+
ctx,
|
|
111
|
+
new SharedReference(null),
|
|
112
|
+
new SharedReference([rep]),
|
|
113
|
+
makePlaybackObserver(obs),
|
|
114
|
+
canceller.signal,
|
|
115
|
+
);
|
|
116
|
+
const result2 = selector(
|
|
112
117
|
ctx,
|
|
113
118
|
new SharedReference(null),
|
|
114
119
|
new SharedReference([rep]),
|
|
@@ -116,17 +121,36 @@ describe("createAdaptiveRepresentationSelector", () => {
|
|
|
116
121
|
canceller.signal,
|
|
117
122
|
);
|
|
118
123
|
|
|
119
|
-
|
|
124
|
+
const samplePayload = {
|
|
125
|
+
requestDuration: 200,
|
|
126
|
+
size: 50000,
|
|
127
|
+
segmentDuration: 4,
|
|
128
|
+
content: {
|
|
129
|
+
representation: rep,
|
|
130
|
+
adaptation: {} as any,
|
|
131
|
+
segment: { isInit: false, complete: true, duration: 4 } as any,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
mockAddSample.mockClear();
|
|
136
|
+
result1.callbacks.metrics(samplePayload);
|
|
137
|
+
result2.callbacks.metrics(samplePayload);
|
|
138
|
+
|
|
139
|
+
// Both callbacks feed the same BandwidthEstimator instance, so addSample
|
|
140
|
+
// is called twice on the *same* prototype method — but more importantly,
|
|
141
|
+
// each call should map to the same underlying instance. We verify this by
|
|
142
|
+
// checking that the `this` context is identical for both invocations.
|
|
143
|
+
expect(mockAddSample).toHaveBeenCalledTimes(2);
|
|
144
|
+
const [call1, call2] = mockAddSample.mock.instances;
|
|
145
|
+
expect(call1).toBe(call2);
|
|
146
|
+
|
|
120
147
|
canceller.cancel("done");
|
|
121
|
-
MockBandwidthEstimator.mockRestore();
|
|
122
148
|
});
|
|
123
149
|
|
|
124
150
|
it("creates separate BandwidthEstimators for different buffer types", () => {
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
const selector = createAdaptiveRepresentationSelector(options);
|
|
151
|
+
const mockAddSample = vi.spyOn(BandwidthEstimator.prototype, "addSample");
|
|
152
|
+
const selector = createAdaptiveRepresentationSelector(makeOptions());
|
|
128
153
|
const rep = makeRepresentation("r1", 500);
|
|
129
|
-
|
|
130
154
|
const canceller = new TaskCanceller("test");
|
|
131
155
|
const obs = makePlaybackObservation();
|
|
132
156
|
|
|
@@ -141,14 +165,14 @@ describe("createAdaptiveRepresentationSelector", () => {
|
|
|
141
165
|
adaptation: { type: "audio" },
|
|
142
166
|
} as any;
|
|
143
167
|
|
|
144
|
-
selector(
|
|
168
|
+
const videoResult = selector(
|
|
145
169
|
videoCtx,
|
|
146
170
|
new SharedReference(null),
|
|
147
171
|
new SharedReference([rep]),
|
|
148
172
|
makePlaybackObserver(obs),
|
|
149
173
|
canceller.signal,
|
|
150
174
|
);
|
|
151
|
-
selector(
|
|
175
|
+
const audioResult = selector(
|
|
152
176
|
audioCtx,
|
|
153
177
|
new SharedReference(null),
|
|
154
178
|
new SharedReference([rep]),
|
|
@@ -156,9 +180,28 @@ describe("createAdaptiveRepresentationSelector", () => {
|
|
|
156
180
|
canceller.signal,
|
|
157
181
|
);
|
|
158
182
|
|
|
159
|
-
|
|
183
|
+
const samplePayload = {
|
|
184
|
+
requestDuration: 200,
|
|
185
|
+
size: 50000,
|
|
186
|
+
segmentDuration: 4,
|
|
187
|
+
content: {
|
|
188
|
+
representation: rep,
|
|
189
|
+
adaptation: {} as any,
|
|
190
|
+
segment: { isInit: false, complete: true, duration: 4 } as any,
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
mockAddSample.mockClear();
|
|
195
|
+
videoResult.callbacks.metrics(samplePayload);
|
|
196
|
+
audioResult.callbacks.metrics(samplePayload);
|
|
197
|
+
|
|
198
|
+
// Each buffer type has its own BandwidthEstimator, so the two addSample
|
|
199
|
+
// calls should come from *different* instances.
|
|
200
|
+
expect(mockAddSample).toHaveBeenCalledTimes(2);
|
|
201
|
+
const [call1, call2] = mockAddSample.mock.instances;
|
|
202
|
+
expect(call1).not.toBe(call2);
|
|
203
|
+
|
|
160
204
|
canceller.cancel("done");
|
|
161
|
-
MockBandwidthEstimator.mockRestore();
|
|
162
205
|
});
|
|
163
206
|
|
|
164
207
|
describe("getEstimates (single representation)", () => {
|
|
@@ -440,10 +483,7 @@ describe("createAdaptiveRepresentationSelector", () => {
|
|
|
440
483
|
}
|
|
441
484
|
|
|
442
485
|
it("metrics callback calls bandwidthEstimator.addSample", () => {
|
|
443
|
-
const mockAddSample = vi.spyOn(
|
|
444
|
-
BandwidthEstimatorModule.default.prototype,
|
|
445
|
-
"addSample",
|
|
446
|
-
);
|
|
486
|
+
const mockAddSample = vi.spyOn(BandwidthEstimator.prototype, "addSample");
|
|
447
487
|
const { callbacks, canceller } = getCallbackSetup();
|
|
448
488
|
callbacks.metrics({
|
|
449
489
|
requestDuration: 200,
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import { describe, beforeEach, it, expect, vi } from "vitest";
|
|
2
|
-
import
|
|
1
|
+
import { describe, beforeEach, it, expect, vi, afterEach } from "vitest";
|
|
2
|
+
import log from "../../../log";
|
|
3
|
+
import BufferBasedChooser from "../buffer_based_chooser";
|
|
3
4
|
import { ScoreConfidenceLevel } from "../utils/representation_score_calculator";
|
|
4
5
|
|
|
6
|
+
const logDebug = vi.spyOn(log, "debug").mockImplementation(() => {
|
|
7
|
+
/* noop */
|
|
8
|
+
});
|
|
9
|
+
const logInfo = vi.spyOn(log, "info").mockImplementation(() => {
|
|
10
|
+
/* noop */
|
|
11
|
+
});
|
|
12
|
+
|
|
5
13
|
describe("BufferBasedChooser", () => {
|
|
6
14
|
beforeEach(() => {
|
|
7
15
|
vi.resetModules();
|
|
8
16
|
});
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
logDebug.mockClear();
|
|
19
|
+
logInfo.mockClear();
|
|
20
|
+
});
|
|
9
21
|
|
|
10
|
-
it("should return the first bitrate if the current bitrate is undefined",
|
|
11
|
-
const logger = { debug: vi.fn() };
|
|
12
|
-
vi.doMock("../../../log", () => ({
|
|
13
|
-
default: logger,
|
|
14
|
-
}));
|
|
15
|
-
const BufferBasedChooser = (await vi.importActual("../buffer_based_chooser"))
|
|
16
|
-
.default as typeof IBufferBasedChooser;
|
|
17
|
-
|
|
22
|
+
it("should return the first bitrate if the current bitrate is undefined", () => {
|
|
18
23
|
let bbc = new BufferBasedChooser([]);
|
|
19
24
|
bbc.onAddedSegment({ bufferGap: 0, speed: 1 });
|
|
20
25
|
expect(bbc.getLastEstimate()).toEqual(undefined);
|
|
@@ -69,14 +74,7 @@ describe("BufferBasedChooser", () => {
|
|
|
69
74
|
expect(bbc.getLastEstimate()).toEqual(1);
|
|
70
75
|
});
|
|
71
76
|
|
|
72
|
-
it("should log an error and return the first bitrate if the given bitrate does not exist",
|
|
73
|
-
const logger = { debug: vi.fn(), info: vi.fn() };
|
|
74
|
-
vi.doMock("../../../log", () => ({
|
|
75
|
-
default: logger,
|
|
76
|
-
}));
|
|
77
|
-
const BufferBasedChooser = (await vi.importActual("../buffer_based_chooser"))
|
|
78
|
-
.default as typeof IBufferBasedChooser;
|
|
79
|
-
|
|
77
|
+
it("should log an error and return the first bitrate if the given bitrate does not exist", () => {
|
|
80
78
|
const bbc = new BufferBasedChooser([10, 20]);
|
|
81
79
|
bbc.onAddedSegment({
|
|
82
80
|
bufferGap: 0,
|
|
@@ -85,21 +83,14 @@ describe("BufferBasedChooser", () => {
|
|
|
85
83
|
currentScore: undefined,
|
|
86
84
|
});
|
|
87
85
|
expect(bbc.getLastEstimate()).toEqual(10);
|
|
88
|
-
expect(
|
|
89
|
-
expect(
|
|
86
|
+
expect(logInfo).toHaveBeenCalledTimes(1);
|
|
87
|
+
expect(logInfo).toHaveBeenCalledWith(
|
|
90
88
|
"ABR",
|
|
91
89
|
"Current Bitrate not found in the calculated levels",
|
|
92
90
|
);
|
|
93
91
|
});
|
|
94
92
|
|
|
95
|
-
it("should not go to the next bitrate if we don't have a high enough maintainability score",
|
|
96
|
-
const logger = { debug: vi.fn() };
|
|
97
|
-
vi.doMock("../../../log", () => ({
|
|
98
|
-
default: logger,
|
|
99
|
-
}));
|
|
100
|
-
const BufferBasedChooser = (await vi.importActual("../buffer_based_chooser"))
|
|
101
|
-
.default as typeof IBufferBasedChooser;
|
|
102
|
-
|
|
93
|
+
it("should not go to the next bitrate if we don't have a high enough maintainability score", () => {
|
|
103
94
|
let bbc = new BufferBasedChooser([10, 20, 40]);
|
|
104
95
|
bbc.onAddedSegment({
|
|
105
96
|
bufferGap: 16,
|
|
@@ -155,14 +146,7 @@ describe("BufferBasedChooser", () => {
|
|
|
155
146
|
expect(bbc.getLastEstimate()).toEqual(20);
|
|
156
147
|
});
|
|
157
148
|
|
|
158
|
-
it("should go to the next bitrate if the current one is maintainable and we have more buffer than the next level",
|
|
159
|
-
const logger = { debug: vi.fn() };
|
|
160
|
-
vi.doMock("../../../log", () => ({
|
|
161
|
-
default: logger,
|
|
162
|
-
}));
|
|
163
|
-
const BufferBasedChooser = (await vi.importActual("../buffer_based_chooser"))
|
|
164
|
-
.default as typeof IBufferBasedChooser;
|
|
165
|
-
|
|
149
|
+
it("should go to the next bitrate if the current one is maintainable and we have more buffer than the next level", () => {
|
|
166
150
|
let bbc = new BufferBasedChooser([10, 20, 40]);
|
|
167
151
|
bbc.onAddedSegment({
|
|
168
152
|
bufferGap: 16,
|
|
@@ -218,14 +202,7 @@ describe("BufferBasedChooser", () => {
|
|
|
218
202
|
expect(bbc.getLastEstimate()).toEqual(40);
|
|
219
203
|
});
|
|
220
204
|
|
|
221
|
-
it("should stay at the current bitrate if it is maintainable but we have a buffer inferior to the next level",
|
|
222
|
-
const logger = { debug: vi.fn() };
|
|
223
|
-
vi.doMock("../../../log", () => ({
|
|
224
|
-
default: logger,
|
|
225
|
-
}));
|
|
226
|
-
const BufferBasedChooser = (await vi.importActual("../buffer_based_chooser"))
|
|
227
|
-
.default as typeof IBufferBasedChooser;
|
|
228
|
-
|
|
205
|
+
it("should stay at the current bitrate if it is maintainable but we have a buffer inferior to the next level", () => {
|
|
229
206
|
let bbc = new BufferBasedChooser([10, 20, 40]);
|
|
230
207
|
bbc.onAddedSegment({
|
|
231
208
|
bufferGap: 6,
|
|
@@ -272,14 +249,7 @@ describe("BufferBasedChooser", () => {
|
|
|
272
249
|
expect(bbc.getLastEstimate()).toEqual(20);
|
|
273
250
|
});
|
|
274
251
|
|
|
275
|
-
it("should stay at the current bitrate if we are currently at the maximum one",
|
|
276
|
-
const logger = { debug: vi.fn() };
|
|
277
|
-
vi.doMock("../../../log", () => ({
|
|
278
|
-
default: logger,
|
|
279
|
-
}));
|
|
280
|
-
const BufferBasedChooser = (await vi.importActual("../buffer_based_chooser"))
|
|
281
|
-
.default as typeof IBufferBasedChooser;
|
|
282
|
-
|
|
252
|
+
it("should stay at the current bitrate if we are currently at the maximum one", () => {
|
|
283
253
|
let bbc = new BufferBasedChooser([10, 20, 40]);
|
|
284
254
|
bbc.onAddedSegment({
|
|
285
255
|
bufferGap: 100000000000,
|
|
@@ -305,14 +275,7 @@ describe("BufferBasedChooser", () => {
|
|
|
305
275
|
expect(bbc.getLastEstimate()).toEqual(40);
|
|
306
276
|
});
|
|
307
277
|
|
|
308
|
-
it("should stay at the current bitrate if the current one is not maintainable due to the speed",
|
|
309
|
-
const logger = { debug: vi.fn() };
|
|
310
|
-
vi.doMock("../../../log", () => ({
|
|
311
|
-
default: logger,
|
|
312
|
-
}));
|
|
313
|
-
const BufferBasedChooser = (await vi.importActual("../buffer_based_chooser"))
|
|
314
|
-
.default as typeof IBufferBasedChooser;
|
|
315
|
-
|
|
278
|
+
it("should stay at the current bitrate if the current one is not maintainable due to the speed", () => {
|
|
316
279
|
let bbc = new BufferBasedChooser([10, 20, 40]);
|
|
317
280
|
bbc.onAddedSegment({
|
|
318
281
|
bufferGap: 15,
|
|
@@ -359,14 +322,7 @@ describe("BufferBasedChooser", () => {
|
|
|
359
322
|
expect(bbc.getLastEstimate()).toEqual(20);
|
|
360
323
|
});
|
|
361
324
|
|
|
362
|
-
it("should lower bitrate if the current one is not maintainable due to the speed",
|
|
363
|
-
const logger = { debug: vi.fn() };
|
|
364
|
-
vi.doMock("../../../log", () => ({
|
|
365
|
-
default: logger,
|
|
366
|
-
}));
|
|
367
|
-
const BufferBasedChooser = (await vi.importActual("../buffer_based_chooser"))
|
|
368
|
-
.default as typeof IBufferBasedChooser;
|
|
369
|
-
|
|
325
|
+
it("should lower bitrate if the current one is not maintainable due to the speed", () => {
|
|
370
326
|
let bbc = new BufferBasedChooser([10, 20, 40]);
|
|
371
327
|
bbc.onAddedSegment({
|
|
372
328
|
bufferGap: 15,
|
|
@@ -413,14 +369,7 @@ describe("BufferBasedChooser", () => {
|
|
|
413
369
|
expect(bbc.getLastEstimate()).toEqual(10);
|
|
414
370
|
});
|
|
415
371
|
|
|
416
|
-
it("should not lower bitrate if the current one is not maintainable due to the speed but confidence on the score is low",
|
|
417
|
-
const logger = { debug: vi.fn() };
|
|
418
|
-
vi.doMock("../../../log", () => ({
|
|
419
|
-
default: logger,
|
|
420
|
-
}));
|
|
421
|
-
const BufferBasedChooser = (await vi.importActual("../buffer_based_chooser"))
|
|
422
|
-
.default as typeof IBufferBasedChooser;
|
|
423
|
-
|
|
372
|
+
it("should not lower bitrate if the current one is not maintainable due to the speed but confidence on the score is low", () => {
|
|
424
373
|
let bbc = new BufferBasedChooser([10, 20, 40]);
|
|
425
374
|
bbc.onAddedSegment({
|
|
426
375
|
bufferGap: 15,
|
|
@@ -476,14 +425,7 @@ describe("BufferBasedChooser", () => {
|
|
|
476
425
|
expect(bbc.getLastEstimate()).toEqual(20);
|
|
477
426
|
});
|
|
478
427
|
|
|
479
|
-
it("should not go to the next bitrate if we do not know if it is maintainable",
|
|
480
|
-
const logger = { debug: vi.fn() };
|
|
481
|
-
vi.doMock("../../../log", () => ({
|
|
482
|
-
default: logger,
|
|
483
|
-
}));
|
|
484
|
-
const BufferBasedChooser = (await vi.importActual("../buffer_based_chooser"))
|
|
485
|
-
.default as typeof IBufferBasedChooser;
|
|
486
|
-
|
|
428
|
+
it("should not go to the next bitrate if we do not know if it is maintainable", () => {
|
|
487
429
|
let bbc = new BufferBasedChooser([10, 20, 40]);
|
|
488
430
|
bbc.onAddedSegment({
|
|
489
431
|
bufferGap: 15,
|
|
@@ -23,7 +23,9 @@ vi.mock("../../../errors", () => ({
|
|
|
23
23
|
formatError: mockFormatError,
|
|
24
24
|
}));
|
|
25
25
|
vi.mock("../../../compat/browser_compatibility_types", () => ({
|
|
26
|
-
|
|
26
|
+
default: {
|
|
27
|
+
MediaSource_: mockMediaSource_,
|
|
28
|
+
},
|
|
27
29
|
}));
|
|
28
30
|
vi.mock("../../../manifest", () => ({
|
|
29
31
|
createRepresentationFilterFromFnString: mockCreateRepresentationFilter,
|
|
@@ -134,11 +136,13 @@ describe("updateCodecSupportInWorkerMode", () => {
|
|
|
134
136
|
mimeType: "video/mp4",
|
|
135
137
|
codecs: ["avc1.42E01E"],
|
|
136
138
|
isCodecSupportedInWebWorker: undefined,
|
|
139
|
+
getMimeTypeString: () => `video/mp4;codecs="avc1.42E01E"`,
|
|
137
140
|
};
|
|
138
141
|
const audioRep = {
|
|
139
142
|
mimeType: "audio/mp4",
|
|
140
143
|
codecs: ["mp4a.40.2"],
|
|
141
144
|
isCodecSupportedInWebWorker: undefined,
|
|
145
|
+
getMimeTypeString: () => `audio/mp4;codecs="mp4a.40.2"`,
|
|
142
146
|
};
|
|
143
147
|
|
|
144
148
|
const manifest = {
|
|
@@ -165,11 +169,13 @@ describe("updateCodecSupportInWorkerMode", () => {
|
|
|
165
169
|
mimeType: "video/mp4",
|
|
166
170
|
codecs: ["avc1.42E01E"],
|
|
167
171
|
isCodecSupportedInWebWorker: undefined,
|
|
172
|
+
getMimeTypeString: () => `video/mp4;codecs="avc1.42E01E"`,
|
|
168
173
|
};
|
|
169
174
|
const rep2 = {
|
|
170
175
|
mimeType: "video/mp4",
|
|
171
176
|
codecs: ["avc1.42E01E"],
|
|
172
177
|
isCodecSupportedInWebWorker: undefined,
|
|
178
|
+
getMimeTypeString: () => `video/mp4;codecs="avc1.42E01E"`,
|
|
173
179
|
};
|
|
174
180
|
|
|
175
181
|
const manifest = {
|
package/src/core/entry/utils.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import BROWSER_GLOBALS from "../../compat/browser_compatibility_types";
|
|
2
2
|
import { formatError } from "../../errors";
|
|
3
3
|
import type { ICorePlaybackObservation } from "../../main_thread/init/utils/create_core_playback_observer";
|
|
4
4
|
import { createRepresentationFilterFromFnString } from "../../manifest";
|
|
@@ -66,7 +66,7 @@ export function synchronizeSegmentSinksOnObservation(
|
|
|
66
66
|
* If MSE in worker is not available, the attribute is not set.
|
|
67
67
|
*/
|
|
68
68
|
export function updateCodecSupportInWorkerMode(manifestToUpdate: Manifest) {
|
|
69
|
-
if (isNullOrUndefined(MediaSource_)) {
|
|
69
|
+
if (isNullOrUndefined(BROWSER_GLOBALS.MediaSource_)) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -78,11 +78,11 @@ export function updateCodecSupportInWorkerMode(manifestToUpdate: Manifest) {
|
|
|
78
78
|
];
|
|
79
79
|
for (const adaptation of checkedAdaptations) {
|
|
80
80
|
for (const representation of adaptation.representations) {
|
|
81
|
-
const codec =
|
|
81
|
+
const codec = representation.getMimeTypeString();
|
|
82
82
|
if (codecsMap.has(codec)) {
|
|
83
83
|
representation.isCodecSupportedInWebWorker = codecsMap.get(codec);
|
|
84
84
|
} else {
|
|
85
|
-
const supported = MediaSource_.isTypeSupported(codec);
|
|
85
|
+
const supported = BROWSER_GLOBALS.MediaSource_.isTypeSupported(codec);
|
|
86
86
|
representation.isCodecSupportedInWebWorker = supported;
|
|
87
87
|
codecsMap.set(codec, supported);
|
|
88
88
|
}
|
|
@@ -165,7 +165,8 @@ export default function createSegmentFetcher<TLoadedFormat, TSegmentDataType>({
|
|
|
165
165
|
periodStart: period.start,
|
|
166
166
|
periodEnd: period.end,
|
|
167
167
|
mimeType: representation.mimeType,
|
|
168
|
-
|
|
168
|
+
baseCodecs: representation.baseCodecs,
|
|
169
|
+
chosenCodec: representation.chosenCodec,
|
|
169
170
|
manifestPublishTime: manifest.publishTime,
|
|
170
171
|
};
|
|
171
172
|
|