Skip to content

Conversation

@cotid-qualabs
Copy link

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @cotid-qualabs, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new functional test to validate the behavior of Alternative MPD events with status="update" in live streaming scenarios. The test ensures that an ongoing alternative content playback, initially without a maxDuration, can be updated mid-stream to include a maxDuration, causing the alternative content to terminate as expected.

Highlights

  • New Functional Test: A new functional test has been added to verify the status="update" functionality for Alternative MPD events in live streams.
  • Alternative MPD Status Update: The test specifically checks if a maxDuration can be successfully applied to an ongoing alternative MPD event via a status update, leading to early termination of the alternative content.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a new functional test for the alternative MPD status update feature in live streams. The test logic is sound, but there are a few areas for improvement in the implementation to enhance maintainability and clarity. I've provided specific suggestions to address these points.


// Create the replace event WITHOUT maxDuration initially
const replaceEvent = {
schemeIdUri: 'urn:mpeg:dash:event:alternativeMPD:replace:2025',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

For better maintainability and to avoid magic strings, please use the predefined constants from Constants.js.

  • On this line and line 69, urn:mpeg:dash:event:alternativeMPD:replace:2025 should be Constants.ALTERNATIVE_MPD.URIS.REPLACE.
  • On line 75, 'update' should be Constants.ALTERNATIVE_MPD.STATUS.UPDATE.
  • On lines 154 and 167, 'replace' should be Constants.ALTERNATIVE_MPD.MODES.REPLACE.
Suggested change
schemeIdUri: 'urn:mpeg:dash:event:alternativeMPD:replace:2025',
schemeIdUri: Constants.ALTERNATIVE_MPD.URIS.REPLACE,

Comment on lines +16 to +17
const duration = 15000; // 15 seconds default duration
const earliestResolutionTimeOffset = 3000;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The values for duration and earliestResolutionTimeOffset are hardcoded here and also in injectStatusUpdateEvent (lines 61 and 63). To improve maintainability and avoid duplication, please define them as constants at a higher scope (e.g., at the top of the file) and reuse them in both functions.

Comment on lines +85 to +95
let existingEventStream = manifest.Period[0].EventStream.find(
stream => stream.schemeIdUri === 'urn:mpeg:dash:event:alternativeMPD:replace:2025'
);

if (existingEventStream) {
// Add the status update event to the existing EventStream
existingEventStream.Event.push(statusUpdateEvent.Event[0]);
} else {
// Add as a new EventStream (this creates the update scenario)
manifest.Period[0].EventStream.push(statusUpdateEvent);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This logic for adding the status update event is a bit confusing. The comment on line 57 (// Keep existing EventStreams...) is misleading because a fresh manifest is retrieved, so existingEventStream will always be undefined in this test's flow. The else block is always executed.

To improve clarity, you can simplify this block to directly add the new event stream, with a comment explaining why this works for an update.

Suggested change
let existingEventStream = manifest.Period[0].EventStream.find(
stream => stream.schemeIdUri === 'urn:mpeg:dash:event:alternativeMPD:replace:2025'
);
if (existingEventStream) {
// Add the status update event to the existing EventStream
existingEventStream.Event.push(statusUpdateEvent.Event[0]);
} else {
// Add as a new EventStream (this creates the update scenario)
manifest.Period[0].EventStream.push(statusUpdateEvent);
}
// Add the status update event as a new EventStream. The player will process this
// as an update because the event has status='update' and a matching ID to an active event.
manifest.Period[0].EventStream.push(statusUpdateEvent);


// Verify that alternative content terminated early due to maxDuration from status update
expect(actualAlternativeDuration).to.be.lessThan(10); // Much less than original 15s
expect(actualAlternativeDuration).to.be.lessThan(12);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This assertion is redundant because the preceding assertion on line 188 (expect(actualAlternativeDuration).to.be.lessThan(10)) is stricter. You can safely remove this line.

…ve-media-presentations/status-update-functional-test
@sebastianpiq sebastianpiq merged commit 1d8f5fd into feature/alternative-media-presentations Oct 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants