Skip to content

VPAAMP-457 Cherry-pick middleware subtitle PTS offset changes from aa…#184

Open
psiva01 wants to merge 1 commit into
developfrom
feature/VPAAMP-457_MW
Open

VPAAMP-457 Cherry-pick middleware subtitle PTS offset changes from aa…#184
psiva01 wants to merge 1 commit into
developfrom
feature/VPAAMP-457_MW

Conversation

@psiva01

@psiva01 psiva01 commented Jun 26, 2026

Copy link
Copy Markdown

…mp commit 2da7d5d

Instead of rewriting the MPEGTS field in the VTT byte stream (fragile header surgery), the PTS offset is pushed into the subtec channel as a signed time offset, matching the pattern already used on the DASH path.

  • subtitleParser.h: add virtual setPtsOffset(double) no-op to base class
  • WebVttSubtecParser.hpp: declare setPtsOffset override; change time_offset_ms_ to signed int64_t
  • WebVttSubtecParser.cpp: implement setPtsOffset; pass time_offset_ms_ to SendDataPacket

Cherry-picked from rdkcentral/aamp@2da7d5d

…mp commit 2da7d5d

Instead of rewriting the MPEGTS field in the VTT byte stream (fragile header
surgery), the PTS offset is pushed into the subtec channel as a signed time
offset, matching the pattern already used on the DASH path.

- subtitleParser.h: add virtual setPtsOffset(double) no-op to base class
- WebVttSubtecParser.hpp: declare setPtsOffset override; change time_offset_ms_ to signed int64_t
- WebVttSubtecParser.cpp: implement setPtsOffset; pass time_offset_ms_ to SendDataPacket

Cherry-picked from rdkcentral/aamp@2da7d5d
@psiva01 psiva01 requested a review from a team as a code owner June 26, 2026 10:19
Copilot AI review requested due to automatic review settings June 26, 2026 10:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a per-fragment subtitle PTS offset API on SubtitleParser and wires that offset into the WebVTT subtec path by passing a signed millisecond offset into SubtecChannel::SendDataPacket, avoiding MPEGTS/VTT header rewriting.

Changes:

  • Add SubtitleParser::setPtsOffset(double) as a default no-op extension point.
  • Update WebVTTSubtecParser to store a signed time_offset_ms_ and pass it into SendDataPacket.
  • Implement WebVTTSubtecParser::setPtsOffset() to convert seconds to a signed millisecond offset using the subtec subtraction convention.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
subtitle/subtitleParser.h Adds a new virtual setPtsOffset API and documents intended usage.
subtec/subtecparser/WebVttSubtecParser.hpp Declares setPtsOffset override and makes time_offset_ms_ signed.
subtec/subtecparser/WebVttSubtecParser.cpp Implements setPtsOffset and forwards time_offset_ms_ into SendDataPacket.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread subtitle/subtitleParser.h
Comment on lines +96 to +104
/**
* @brief Set a per-fragment PTS offset (seconds) that the parser
* applies when forwarding cue data to its subtitle sink.
*
* Used by the HLS PTS-restamp path to align subtitle display time
* with the restamped video PTS without rewriting MPEGTS in the
* VTT header. Default no-op; subtec-based parsers override.
*/
virtual void setPtsOffset(double ptsOffsetSec) {}
Comment thread subtitle/subtitleParser.h
* with the restamped video PTS without rewriting MPEGTS in the
* VTT header. Default no-op; subtec-based parsers override.
*/
virtual void setPtsOffset(double ptsOffsetSec) {}
Comment on lines 69 to 73
bool WebVTTSubtecParser::processData(const char* buffer, size_t bufferLen, double position, double duration)
{
std::string str(const_cast<const char*>(buffer), bufferLen);
std::vector<uint8_t> data(str.begin(), str.end());

Comment on lines +79 to +83
void WebVTTSubtecParser::setPtsOffset(double ptsOffsetSec)
{
// Subtec's display_time = media_PTS - time_offset_ms (subtraction
// convention shared with Rialto SetSubtitlePtsOffset). The HLS
// restamped video PTS is media_PTS + ptsOffsetSec, so we negate

@DomSyna DomSyna left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

So I'm assuming as its not clear from the PR description (to me anyway) this is porting the changes from the "amp middleware" to middleware develop as part of aligning the code.

The port looks identical to me

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