Skip to content

VPLAY-13208 [VIPA] [Linear]- Progress Bar Point jumping to the End Wh…#1363

Open
anjali-syna wants to merge 11 commits intodev_sprint_25_2from
feature/VPLAY-13208
Open

VPLAY-13208 [VIPA] [Linear]- Progress Bar Point jumping to the End Wh…#1363
anjali-syna wants to merge 11 commits intodev_sprint_25_2from
feature/VPLAY-13208

Conversation

@anjali-syna
Copy link
Copy Markdown
Contributor

@anjali-syna anjali-syna commented Apr 27, 2026

…ile performing Trick Play/Seek

Reason for change: Progress Bar Point jumping to the end and playing
from live play position while performing Trick Play/Seek in Linear channels.
This issue is seen only in one platform. In the problematic scenario,
aamp is receiving many underflows callbacks - GstPlayer_OnGstBufferUnderflowCb,
from rialtomsevideosink0, due to which EOS flow is triggered from
VideoDecoderPtsCheckerForEOS, as 'video-pts' property is not supported in
RialtoMSEVideoSink.

Changes:

  • Modifying aamp's underflow EOS implementation to fallback to gst_element_query_position, if 'video-pts' property is not supported.Both VideoDecoderPtsCheckerForEOS and GstPlayer_OnGstBufferUnderflowCb compare real playback positions in the absence of video-pts property, so a mid-underflow position change prevents NotifyEOS() from firing. Also, modified the code to allow pts check for EOS only during normal play, and not for forward trick play.

Test Procedure: Refer JIRA ticket

Risks: low

…ile performing Trick Play/Seek

Reason for change: Progress Bar Point jumping to the end and playing
 from live play position while performing Trick Play/Seek in Linear channels.
 This issue is seen only in one platform. In the problematic scenario,
 aamp is receiving many underflows callbacks - GstPlayer_OnGstBufferUnderflowCb,
 from rialtomsevideosink0, due to which EOS flow is triggered from
 VideoDecoderPtsCheckerForEOS, as 'video-pts' property is not supported in
 RialtoMSEVideoSink.

Changes:
* Modifying aamp's underflow EOS implementation to fallback to
  gst_element_query_position, if 'video-pts' property is not supported.
  This stops the trick-play false-EOS, both VideoDecoderPtsCheckerForEOS
  and GstPlayer_OnGstBufferUnderflowCb compare real playback positions
  in the absence of video-pts property, so a mid-underflow position change
  prevents NotifyEOS() from firing.

Test Procedure: Refer JIRA ticket

Risks: low
…ile performing Trick Play/Seek

Reason for change: Progress Bar Point jumping to the end and playing
 from live play position while performing Trick Play/Seek in Linear channels.
 This issue is seen only in one platform. In the problematic scenario,
 aamp is receiving many underflows callbacks - GstPlayer_OnGstBufferUnderflowCb,
 from rialtomsevideosink0, due to which EOS flow is triggered from
 VideoDecoderPtsCheckerForEOS, as 'video-pts' property is not supported in
 RialtoMSEVideoSink.

Changes:
* Modifying aamp's underflow EOS implementation to fallback to
  gst_element_query_position, if 'video-pts' property is not supported.
  This stops the trick-play false-EOS, both VideoDecoderPtsCheckerForEOS
  and GstPlayer_OnGstBufferUnderflowCb compare real playback positions
  in the absence of video-pts property, so a mid-underflow position change
  prevents NotifyEOS() from firing.

Test Procedure: Refer JIRA ticket

Risks: low
Signed-off-by: anjali-syna <206662904+anjali-syna@users.noreply.github.com>
@anjali-syna anjali-syna marked this pull request as ready for review April 30, 2026 04:32
@anjali-syna anjali-syna requested a review from a team as a code owner April 30, 2026 04:32
@DomSyna DomSyna self-requested a review April 30, 2026 09:32
*
* @return Video PTS in nanoseconds, or -1 on error.
*/
long long SocInterface::GetVideoPts(GstElement *video_sink, GstElement *video_dec, bool isWesteros)
Copy link
Copy Markdown
Contributor

@DomSyna DomSyna Apr 30, 2026

Choose a reason for hiding this comment

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

Did you consider std::optional for the method instead or returning -1 ? it would avoid the need of the magic -1

Might be too bigger change in the various call sites

* Once probed against a non-NULL video sink/decoder, the result is
* reused for the lifetime of this SocInterface instance to avoid
* repeated g_object_class_find_property() calls on hot paths. */
bool mVideoPtsPropertyChecked = false;
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.

Do these need to be protected for thread safety ? Is it possible that the GST signal handling thread, and the AAMP player thread could access the method at same time ?

maybe:
std::once_flag mVideoPtsPropertyChecked
std::atomic mVideoPtsPropertySupported

*/
bool SocInterface::IsVideoPtsPropertySupported(GstElement *element)
{
if(!mVideoPtsPropertyChecked)
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.

with std::once_flag you could remove this check, and inside the scope of element
std::call_once(mVideoPtsPropertyChecked, lambda fn to find the property, set the supported flag, and log

gint64 currentPTS = 0;
if(video_dec)
{
if(!IsVideoPtsPropertySupported(video_dec))
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.

This sequence is duplicated in both cpp files
If(!IsVideo..
g_object_get()

Is it worth moving into a protected helper in SicInterface.h
std::optional ReadVideoPts(GstElement *element); // null when no PTS

* Fall back to gst_element_query_position and convert ms to 90 kHz
* ticks (1 ms = 90 ticks) so that callers relying on PTS units
* (90 kHz) keep working. */
MW_LOG_INFO("InterfacePlayerRDK - 'video-pts' property is not supported on this platform; Fall back to gst_element_query_position");
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.

Could this flood the logs on a platform where video-pts isn't supported ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Modified it as TRACE.

MW_LOG_INFO("InterfacePlayerRDK - 'video-pts' property is not supported on this platform; Fall back to gst_element_query_position");
currentPTS = MPEG_PTS_TICKS_PER_MS * GetVideoPosition();
}
return (long long)currentPTS;
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.

cpp not C
static_cast

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

existing code; modified now.

}

MW_LOG_INFO("InterfacePlayerRDK: position(ms) = %" G_GINT64_FORMAT , GST_TIME_AS_MSECONDS(position));
return (long long)(GST_TIME_AS_MSECONDS(position));
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.

as above cpp not C

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

modified

* Used to convert a millisecond playback position into 90 kHz ticks
* when the 'video-pts' property is not exposed by the platform.
*/
static constexpr long long MPEG_PTS_TICKS_PER_MS = 90LL;
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.

I'd be surprised if there isn't already a define for this somewhere ?
Would
inline constexpr
be better ?

/* The 'video-pts' property is not exposed on this platform.
* Signal to the caller so it can fall back to
* gst_element_query_position. */
return -1;
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.

Can we avoid the early return, same with SocInterface

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

if(!IsVideoPtsPropertySupported(video_dec))
{
/* The 'video-pts' property is not exposed on this platform.
* Signal to the caller so it can fall back to
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.

I'd remove this bit of the comment, as it assumes the caller's intention

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

*
* @return true if 'video-pts' is exposed on the element, false otherwise.
*/
virtual bool IsVideoPtsPropertySupported(GstElement *element);
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.

Should this alsobe marked as nodiscard ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

}
bool SocInterface::IsVideoPtsPropertySupported(GstElement *element)
{
if(!mVideoPtsPropertyChecked)
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.

Do we need all this logic in the fake? The same comment applies to SocInterface::GetVideoPts() fake. Ideally the fakes would contain no logic at all, although there is already logic in the existing ones :(

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.

4 participants