Skip to content

fix: Add fallback for contentBitrate and convert adBitrate from KBPS to BPS#118

Closed
avinash-newrelic wants to merge 1 commit intomasterfrom
fix/NR-525912
Closed

fix: Add fallback for contentBitrate and convert adBitrate from KBPS to BPS#118
avinash-newrelic wants to merge 1 commit intomasterfrom
fix/NR-525912

Conversation

@avinash-newrelic
Copy link
Copy Markdown
Collaborator

Summary

  • contentBitrate was always reported as 0 when manifest-declared bitrate was unavailable. Added a fallback to calculate bitrate from actual download data.
  • adBitrate was incorrectly reported in KBPS instead of BPS. Applied conversion (×1000) to match the data model specification.

Changes

  • NRTrackerExoPlayer.java — Added fallback bitrate calculation using download speed when player.getVideoFormat().bitrate is unavailable
  • NRTrackerIMA.java — Multiplied getVastMediaBitrate() by 1000 to convert KBPS to BPS

Test Plan

  • Play content video and verify contentBitrate reports a non-zero value in BPS
  • Play content with HLS/DASH stream and verify manifest-declared bitrate is still preferred
  • Play video with IMA ads and verify adBitrate reports in BPS (e.g., 500000 instead of 500)
  • Verify cross-platform consistency with iOS bitrate values

Copy link
Copy Markdown
Contributor

@mlychndnnr mlychndnnr left a comment

Choose a reason for hiding this comment

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

lgtm

// Use actual video bitrate from player's video format instead of download speed
if (player != null && player.getVideoFormat() != null && player.getVideoFormat().bitrate != C.INDEX_UNSET) {
this.actualBitrate = player.getVideoFormat().bitrate;
} else {
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.

@avinash-newrelic @mlychndnnr this PR needs to merged to a release branch

@mlychndnnr mlychndnnr closed this Apr 21, 2026
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