Prebid Mobile: makes creative size transformation based on pxRatio.#4510
Open
mdanylov-sigma wants to merge 1 commit into
Open
Prebid Mobile: makes creative size transformation based on pxRatio.#4510mdanylov-sigma wants to merge 1 commit into
mdanylov-sigma wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #4501
Prebid Server was not converting
device.w/device.hfrom physical pixels to device-independent pixels (DIPs) when generating the list of candidate sizes for interstitial ads. According to the OpenRTB spec,device.w/device.hrepresent physical screen pixels, whilebanner.formatsizes are expected in DIPs. On high-density screens this caused standard mobile interstitial sizes (e.g. 320x480) to be absent from the generated format list.This change adds opt-in pxratio conversion controlled by a new field
ext.prebid.sdk.usepxratio. When set totrue,device.w/device.hare divided bydevice.pxratiobefore being used to calculate the interstitial size bounds. Conversion is only applied when falling back to device dimensions — explicitbanner.formatsizes are left untouched.Changes
usePxRatio(Boolean, JSON:usepxratio) field toExtRequestPrebidSdk; added explicitof()factory overloads to preserve backward compatibility with existing callersusePxRatio(BidRequest)helper to read the flag fromext.prebid.sdkdeviceSizeToDips(Integer, BigDecimal)helper: divides bypxratiousingdoubleValue(), rounds to nearest integer, clamps to minimum 1; returns size unchanged whensizeorpxratiois null or non-positiveprocessInterstitialImp()only in the device-size fallback branchTesting
processShouldReturnBidRequestUpdatedWithInterstitialFormatsUsingDeviceSizeInDipsWhenFormatIsEmpty— device 1080×1920 @ pxratio 3 → expects 320×480 in resultsprocessShouldReturnBidRequestUpdatedWithInterstitialFormatsUsingDeviceSizeInDipsWhenFormatIsOneToOne— same, with 1×1 sentinel formatprocessShouldNotConvertExplicitFormatSizeUsingDevicePxratio— explicit banner format is not convertedprocessShouldKeepCurrentDeviceSizeBehaviorWhenUsePxRatioIsAbsent— no flag, no conversion (backward compatibility)processShouldKeepCurrentDeviceSizeBehaviorWhenUsePxRatioIsTrueAndDevicePxRatioIsAbsent— flag set butpxratiomissing, sizes unchanged