Skip to content

Commit

Permalink
Merge branch 'main' into v-nova_Lcevc
Browse files Browse the repository at this point in the history
  • Loading branch information
vinod-balakrishnan authored Oct 1, 2022
2 parents 7a86ddb + 3582f0a commit 3cb53ee
Show file tree
Hide file tree
Showing 37 changed files with 622 additions and 38 deletions.
47 changes: 31 additions & 16 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ jobs:
include:
# Run Linux browsers with xvfb, so they're in a headless X session.
# Additionally, generate a code coverage report from Linux Chrome.
# It should be the uncompiled build, or else we won't execute any
# coverage instrumentation on full-stack player integration tests.
- os: ubuntu-latest
browser: Chrome
extra_flags: "--use-xvfb --html-coverage-report"
extra_flags: "--use-xvfb --html-coverage-report --uncompiled"
- os: ubuntu-latest
browser: Firefox
extra_flags: "--use-xvfb"
Expand All @@ -57,7 +59,7 @@ jobs:
- os: macos-latest
browser: Safari
- os: macos-latest
browser: Safari-14
browser: Safari-old

- os: windows-latest
browser: Chrome
Expand Down Expand Up @@ -87,21 +89,22 @@ jobs:
with:
ref: ${{ github.event.inputs.ref || github.ref }}

# Safari 14 can be installed, but not to the root, and it can't replace
# the standard version, at least not on GitHub's VMs. If you try to
# install directly to the root with sudo, it will appear to succeed, but
# will have no effect. If you try to script it explicitly with rm -rf
# and cp, this will fail. Safari may be on a read-only filesystem.
- name: Install Safari 14 to home directory
if: matrix.os == 'macos-latest' && matrix.browser == 'Safari-14'
# Older versions of Safari can be installed, but not to the root, and it
# can't replace the standard version, at least not on GitHub's VMs. If
# you try to install directly to the root with sudo, it will appear to
# succeed, but will have no effect. If you try to script it explicitly
# with rm -rf and cp, this will fail. Safari may be on a read-only
# filesystem.
- name: Install old Safari to home directory
if: matrix.os == 'macos-latest' && matrix.browser == 'Safari-old'
run: |
# Download Safari 14
# See also https://www.macupdate.com/app/mac/15675/apple-safari/old-versions
curl -Lv https://www.macupdate.com/action/download/62946 > Safari14.0CatalinaAuto.pkg.zip
# Download Safari 15
# This URL discovered through the seed files listed at
# https://github.com/zhangyoufu/swscan.apple.com/blob/master/url.txt
curl -Lv http://swcdn.apple.com/content/downloads/42/33/012-57329-A_41P2VU6UHN/5fw5vna27fdw4mqfak5adj3pjpxvo9hgh7/Safari15.6.1CatalinaAuto.pkg > Safari.pkg
# Install Safari 14 to homedir specifically.
unzip Safari14.0CatalinaAuto.pkg.zip
installer -pkg Safari14.0CatalinaAuto.pkg -target CurrentUserHomeDirectory
# Install older Safari to homedir specifically.
installer -pkg Safari.pkg -target CurrentUserHomeDirectory
# Install a launcher that can execute a shell script to launch this
npm install karma-script-launcher --save-dev
Expand All @@ -114,7 +117,7 @@ jobs:
run: |
browser=${{ matrix.browser }}
if [[ "$browser" == "Safari-14" ]]; then
if [[ "$browser" == "Safari-old" ]]; then
# Replace the browser name with a script that can launch this
# browser from the command line.
browser="$PWD/.github/workflows/safari-homedir-launcher.sh"
Expand Down Expand Up @@ -165,6 +168,18 @@ jobs:
# an environment variable set, the file should definitely be there.
if-no-files-found: error

# Upload new screenshots and diffs on failure; ignore if missing
- name: Upload screenshots
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: screenshots-${{ matrix.browser }}
path: |
test/test/assets/screenshots/*/*.png-new
test/test/assets/screenshots/*/*.png-diff
if-no-files-found: ignore
retention-days: 5

build_in_docker:
# Don't waste time doing a full matrix of test runs when there was an
# obvious linter error.
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/selenium-lab-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ jobs:
# the container.
- name: Test Player
run: |
# Generate a coverage report from uncompiled code on ChromeLinux.
# It should be the uncompiled build, or else we won't execute any
# coverage instrumentation on full-stack player integration tests.
if [[ "${{ matrix.browser }}" == "ChromeLinux" ]]; then
extra_flags="--html-coverage-report --uncompiled"
else
extra_flags=""
fi
python3 build/test.py \
--no-build \
--reporters spec --spec-hide-passed \
Expand All @@ -189,7 +198,7 @@ jobs:
--grid-config build/shaka-lab.yaml \
--grid-address selenium-grid.lab:4444 \
--browsers ${{ matrix.browser }} \
--html-coverage-report
$extra_flags
- name: Find coverage report (ChromeLinux only)
id: coverage
Expand Down
3 changes: 3 additions & 0 deletions demo/common/message_ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ shakaDemo.MessageIds = {
MAX_HEIGHT: 'DEMO_MAX_HEIGHT',
MAX_PIXELS: 'DEMO_MAX_PIXELS',
MAX_WIDTH: 'DEMO_MAX_WIDTH',
MEDIA_SOURCE_SECTION_HEADER: 'DEMO_MEDIA_SOURCE_SECTION_HEADER',
MIN_BANDWIDTH: 'DEMO_MIN_BANDWIDTH',
MIN_BYTES: 'DEMO_MIN_BYTES',
MIN_FRAMERATE: 'DEMO_MIN_FRAMERATE',
Expand All @@ -244,13 +245,15 @@ shakaDemo.MessageIds = {
PREFER_NATIVE_HLS: 'DEMO_PREFER_NATIVE_HLS',
REBUFFERING_GOAL: 'DEMO_REBUFFERING_GOAL',
RESTRICT_TO_ELEMENT_SIZE: 'DEMO_RESTRICT_TO_ELEMENT_SIZE',
RESTRICT_TO_SCREEN_SIZE: 'DEMO_RESTRICT_TO_SCREEN_SIZE',
RESTRICTIONS_SECTION_HEADER: 'DEMO_RESTRICTIONS_SECTION_HEADER',
SAFE_SEEK_OFFSET: 'DEMO_SAFE_SEEK_OFFSET',
SAFE_SKIP_DISTANCE: 'DEMO_SAFE_SKIP_DISTANCE',
SEGMENT_RELATIVE_VTT_TIMING: 'DEMO_SEGMENT_RELATIVE_VTT_TIMING',
SESSION_ID: 'DEMO_SESSION_ID',
SHAKA_CONTROLS: 'DEMO_SHAKA_CONTROLS',
SLOW_HALF_LIFE: 'DEMO_SLOW_HALF_LIFE',
SOURCE_BUFFER_EXTRA_FEATURES: 'DEMO_SOURCE_BUFFER_EXTRA_FEATURES',
STALL_DETECTOR_ENABLED: 'DEMO_STALL_DETECTOR_ENABLED',
STALL_THRESHOLD: 'DEMO_STALL_THRESHOLD',
STALL_TIMEOUT: 'DEMO_STALL_TIMEOUT',
Expand Down
12 changes: 12 additions & 0 deletions demo/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ shakaDemo.Config = class {
this.addOfflineSection_();
this.addDrmSection_();
this.addStreamingSection_();
this.addMediaSourceSection_();
this.addManifestSection_();
this.addRetrictionsSection_('',
shakaDemo.MessageIds.RESTRICTIONS_SECTION_HEADER);
Expand Down Expand Up @@ -275,6 +276,8 @@ shakaDemo.Config = class {
/* canBeDecimal= */ true)
.addBoolInput_(MessageIds.RESTRICT_TO_ELEMENT_SIZE,
'abr.restrictToElementSize')
.addBoolInput_(MessageIds.RESTRICT_TO_SCREEN_SIZE,
'abr.restrictToScreenSize')
.addBoolInput_(MessageIds.IGNORE_DEVICE_PIXEL_RATIO,
'abr.ignoreDevicePixelRatio');
this.addRetrictionsSection_('abr',
Expand Down Expand Up @@ -438,6 +441,15 @@ shakaDemo.Config = class {
MessageIds.STREAMING_RETRY_SECTION_HEADER);
}

/** @private */
addMediaSourceSection_() {
const MessageIds = shakaDemo.MessageIds;
const docLink = this.resolveExternLink_('.MediaSourceConfiguration');
this.addSection_(MessageIds.MEDIA_SOURCE_SECTION_HEADER, docLink)
.addTextInput_(MessageIds.SOURCE_BUFFER_EXTRA_FEATURES,
'mediaSource.sourceBufferExtraFeatures');
}

/** @private */
addLanguageSection_() {
const MessageIds = shakaDemo.MessageIds;
Expand Down
3 changes: 3 additions & 0 deletions demo/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"DEMO_MAX_HEIGHT": "Max Height",
"DEMO_MAX_PIXELS": "Max Pixels",
"DEMO_MAX_WIDTH": "Max Width",
"DEMO_MEDIA_SOURCE_SECTION_HEADER": "Media source",
"DEMO_METACDN": "MetaCDN",
"DEMO_MICROSOFT": "Microsoft",
"DEMO_MIME_TYPE": "MIME Type",
Expand Down Expand Up @@ -188,6 +189,7 @@
"DEMO_REBUFFERING_GOAL": "Rebuffering Goal",
"DEMO_REPORT_BUG": "REPORT BUG",
"DEMO_RESTRICT_TO_ELEMENT_SIZE": "Restrict to element size",
"DEMO_RESTRICT_TO_SCREEN_SIZE": "Restrict to screen size",
"DEMO_RESTRICTIONS_SECTION_HEADER": "Restrictions",
"DEMO_SAFE_SEEK_OFFSET": "Safe Seek Offset",
"DEMO_SAFE_SKIP_DISTANCE": "Safe Skip Distance",
Expand All @@ -198,6 +200,7 @@
"DEMO_SHAKA_CONTROLS": "Shaka Controls",
"DEMO_SLOW_HALF_LIFE": "Slow half life",
"DEMO_SOURCE": "Source on GitHub",
"DEMO_SOURCE_BUFFER_EXTRA_FEATURES": "Source buffer extra features",
"DEMO_SOURCE_SEARCH": "Source",
"DEMO_STALL_DETECTOR_ENABLED": "Stall Detector Enabled",
"DEMO_STALL_THRESHOLD": "Stall Threshold",
Expand Down
12 changes: 12 additions & 0 deletions demo/locales/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,10 @@
"description": "The name of a configuration value.",
"message": "Max Width"
},
"DEMO_MEDIA_SOURCE_SECTION_HEADER": {
"description": "The header for a section of configuration values.",
"message": "Media source"
},
"DEMO_METACDN": {
"description": "Text that describes an asset that comes from the MetaCDN asset library.",
"message": "[PROPER_NAME:MetaCDN]"
Expand Down Expand Up @@ -755,6 +759,10 @@
"description": "The name of a configuration value.",
"message": "Restrict to element size"
},
"DEMO_RESTRICT_TO_SCREEN_SIZE": {
"description": "The name of a configuration value.",
"message": "Restrict to screen size"
},
"DEMO_RESTRICTIONS_SECTION_HEADER": {
"description": "The header for a section of configuration values.",
"message": "Restrictions"
Expand Down Expand Up @@ -795,6 +803,10 @@
"description": "A link in the footer, to the Shaka Player source on GitHub.",
"message": "Source on [PROPER_NAME:GitHub]"
},
"DEMO_SOURCE_BUFFER_EXTRA_FEATURES": {
"description": "The name of a configuration value.",
"message": "Source buffer extra features"
},
"DEMO_SOURCE_SEARCH": {
"description": "A header on a search field that filters by the source of the asset.",
"message": "Source"
Expand Down
6 changes: 6 additions & 0 deletions externs/ima.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ google.ima.Ad = class {

/** @return {string} */
getTitle() {}

/** @return {string} */
getDescription() {}
};


Expand Down Expand Up @@ -395,6 +398,9 @@ google.ima.dai.api.Ad = class {

/** @return {string} */
getTitle() {}

/** @return {string} */
getDescription() {}
};


Expand Down
5 changes: 5 additions & 0 deletions externs/shaka/ads.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,9 @@ shaka.extern.IAd = class {
* @return {string}
*/
getTitle() {}

/**
* @return {string}
*/
getDescription() {}
};
26 changes: 25 additions & 1 deletion externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,23 @@ shaka.extern.ManifestConfiguration;
shaka.extern.StreamingConfiguration;


/**
* @typedef {{
* sourceBufferExtraFeatures: string
* }}
*
* @description
* Media source configuration.
*
* @property {string} sourceBufferExtraFeatures
* Some platforms may need to pass features when initializing the
* sourceBuffer.
* This string is ultimately appended to MIME types in addSourceBuffer().
* @exportDoc
*/
shaka.extern.MediaSourceConfiguration;


/**
* @typedef {{
* enabled: boolean,
Expand All @@ -1028,6 +1045,7 @@ shaka.extern.StreamingConfiguration;
* bandwidthDowngradeTarget: number,
* advanced: shaka.extern.AdvancedAbrConfiguration,
* restrictToElementSize: boolean,
* restrictToScreenSize: boolean,
* ignoreDevicePixelRatio: boolean
* }}
*
Expand Down Expand Up @@ -1063,9 +1081,12 @@ shaka.extern.StreamingConfiguration;
* Note: The use of ResizeObserver is required for it to work properly. If
* true without ResizeObserver, it behaves as false.
* Defaults false.
* @property {boolean} restrictToScreenSize
* If true, restrict the quality to screen size.
* Defaults false.
* @property {boolean} ignoreDevicePixelRatio
* If true,device pixel ratio is ignored when restricting the quality to
* media element size.
* media element size or screen size.
* Defaults false.
* @exportDoc
*/
Expand Down Expand Up @@ -1220,6 +1241,7 @@ shaka.extern.OfflineConfiguration;
* drm: shaka.extern.DrmConfiguration,
* manifest: shaka.extern.ManifestConfiguration,
* streaming: shaka.extern.StreamingConfiguration,
* mediaSource: shaka.extern.MediaSourceConfiguration,
* abrFactory: shaka.extern.AbrManager.Factory,
* abr: shaka.extern.AbrConfiguration,
* cmcd: shaka.extern.CmcdConfiguration,
Expand Down Expand Up @@ -1248,6 +1270,8 @@ shaka.extern.OfflineConfiguration;
* Manifest configuration and settings.
* @property {shaka.extern.StreamingConfiguration} streaming
* Streaming configuration and settings.
* @property {shaka.extern.MediaSourceConfiguration} mediaSource
* Media source configuration and settings.
* @property {shaka.extern.AbrManager.Factory} abrFactory
* A factory to construct an abr manager.
* @property {shaka.extern.AbrConfiguration} abr
Expand Down
7 changes: 7 additions & 0 deletions lib/abr/simple_abr_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ shaka.abr.SimpleAbrManager = class {
let maxHeight = Infinity;
let maxWidth = Infinity;

if (this.config_.restrictToScreenSize) {
const devicePixelRatio =
this.config_.ignoreDevicePixelRatio ? 1 : window.devicePixelRatio;
maxHeight = window.screen.height * devicePixelRatio;
maxWidth = window.screen.width * devicePixelRatio;
}

if (this.resizeObserver_ && this.config_.restrictToElementSize) {
const devicePixelRatio =
this.config_.ignoreDevicePixelRatio ? 1 : window.devicePixelRatio;
Expand Down
8 changes: 8 additions & 0 deletions lib/ads/client_side_ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,14 @@ shaka.ads.ClientSideAd = class {
return this.ad_.getTitle();
}

/**
* @override
* @export
*/
getDescription() {
return this.ad_.getDescription();
}

/**
* @override
* @export
Expand Down
8 changes: 8 additions & 0 deletions lib/ads/server_side_ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ shaka.ads.ServerSideAd = class {
return this.ad_.getTitle();
}

/**
* @override
* @export
*/
getDescription() {
return this.ad_.getDescription();
}

/**
* @override
* @export
Expand Down
1 change: 1 addition & 0 deletions lib/cast/cast_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ shaka.cast.CastUtils.PlayerInitAfterLoadState = [
shaka.cast.CastUtils.PlayerVoidMethods = [
'addChaptersTrack',
'addTextTrackAsync',
'addThumbnailsTrack',
'cancelTrickPlay',
'configure',
'getChapters',
Expand Down
4 changes: 4 additions & 0 deletions lib/cea/cea608_memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ shaka.cea.Cea608Memory = class {
* @param {number} count Count of rows to move.
*/
moveRows(dst, src, count) {
if (src < 0 || dst < 0) {
return;
}

if (dst >= src) {
for (let i = count-1; i >= 0; i--) {
this.rows_[dst + i] = this.rows_[src + i].map((e) => e);
Expand Down
Loading

0 comments on commit 3cb53ee

Please sign in to comment.