Replies: 4 comments
|
Real concern (IPC overhead + partial-state risk during reconfiguration), but the proposed mechanism doesn't fit the existing types and has a redundant parameter. Two corrections + a counter-proposal: Issues with the proposal as written1. The values aren't
|
| Setter | Parameter type |
|---|---|
setMasteringDisplayInfo |
@nullable MasteringDisplayInfo (parcelable) |
setContentLightLevel |
@nullable ContentLightLevel (parcelable) |
setColorimetry |
Colorimetry (enum — but expanding to 4 fields per #367) |
setStreamResolution |
int width, int height |
setFrameRate |
int numerator, int denominator |
setDolbyVisionLayerFlags |
boolean blPresent, boolean elPresent |
setPixelAspectRatio (#441 proposal) |
int parX, int parY |
The current Property enum (lines 1-12 of Property.aidl) only contains structural items (RESOURCE_ID, INPUT_QUEUE_DEPTH, OPERATIONAL_MODE, LOW_LATENCY_MODE, etc.) — none of the HDR/colorimetry/resolution/framerate values. To make PropertyKVPair[] carry these, PropertyValue would have to grow into a giant union supporting MasteringDisplayInfo, ContentLightLevel, Colorimetry, paired ints for resolution/framerate/PAR/DV flags, etc. That's a worse type-safety story than the current per-setter approach.
2. VideoDecoderResourceIndex is redundant
IVideoDecoderController is already per-instance — the controller you hold is for one specific decoder (acquired via IVideoDecoder.open()). There's no need to pass a resource index in every call. The implicit this of the controller already identifies the target.
Counter-proposal — structured config parcelable
Define a single VideoDecoderStreamConfig parcelable that bundles all the stream-description fields, and one setStreamConfig() method. Atomic, type-safe, no PropertyValue expansion:
@VintfStability
parcelable VideoDecoderStreamConfig {
// Resolution
@nullable Resolution resolution; // {width, height}, null = no change
// Frame rate
@nullable Fraction frameRate; // {numerator, denominator}, null = no change
// Pixel aspect ratio (per #441)
@nullable Fraction pixelAspectRatio; // null = no change
// Colour
@nullable Colorimetry colorimetry; // null = no change
@nullable MasteringDisplayInfo masteringDisplayInfo;
@nullable ContentLightLevel contentLightLevel;
// Dolby Vision
@nullable DolbyVisionLayerFlags dolbyVisionLayerFlags; // {blPresent, elPresent}, null = no change
}
// On IVideoDecoderController:
void setStreamConfig(in VideoDecoderStreamConfig config);Properties of this shape:
- Atomic: all fields land in one binder transaction
- Partial:
nullfields mean "no change" — clients send only what's actually changing - Type-safe: structured parcelables, no PropertyValue gymnastics
- Discoverable: clients see the full set of stream-description fields in one place
- Per-instance: lives on the controller, no resource index needed
The existing 6 individual setters can stay as convenience aliases (or be deprecated and removed in the next major version — pre-restructure timing).
What about non-stream-description properties?
Properties that are genuinely key-value (DECODE_ERROR_POLICY, OPERATIONAL_MODE, LOW_LATENCY_MODE, etc.) keep using setProperty(Property, PropertyValue). If atomic batching is needed for those too, a setPropertyMulti(PropertyKVPair[]) is straightforward and uses existing types — but it's a separate concern from the stream-description bundling.
Two questions before this becomes a tracking issue:
- Do you agree the structured-parcelable shape is the right answer (vs the PropertyValue-expansion path)?
- Should the existing 6 typed setters be kept as convenience aliases or removed (pre-restructure)?
Correction to my earlier counter-proposal — ABR exposes a real gapRe-checked the existing setters: all 6 are Two distinct casesCase A — bitstream-derived changes (resolution, frame rate, in-stream colorimetry, in-stream HDR SEI):
Case B — container-derived changes (HDR static metadata in MP4
Revised proposalTwo surfaces with clear scope:
@VintfStability
parcelable InputBufferMetadata {
long nsPresentationTime;
boolean endOfStream;
boolean discontinuity;
// NEW — optional overrides applied from this frame onward.
// null = no change. Bitstream-derived values still take precedence.
@nullable MasteringDisplayInfo masteringDisplayInfo;
@nullable ContentLightLevel contentLightLevel;
@nullable Colorimetry colorimetry;
@nullable DolbyVisionLayerFlags dolbyVisionLayerFlags;
}Why per-buffer rather than a separate
What this resolves vs leaves open
Note on
|
|
Agreed direction (confirmed by @Ulrond / Gerald): Both surfaces, scoped by lifecycle: Surface 1 —
|
| Scenario | Solved by |
|---|---|
| Atomic initial config | Surface 1 (setStreamConfig) |
| ABR resolution / framerate change | Already works — bitstream-derived |
| ABR HDR profile change per DASH Period | Surface 2 (per-buffer overrides) |
| SSAI ad insertion (same codec, same encryption) | Surface 2 (per-buffer overrides on the ad boundary frame) |
| SSAI with codec or encryption-mode change | Decoder restart (middleware policy) |
| Live→VOD transition | Surface 2 (per-buffer overrides) |
Next steps
- Raise a tracking issue for both surfaces (or convert this discussion to one).
- Implementation can be done in a single PR once feat(videodecoder): add setPixelAspectRatio() and clarify hint precedence + persistence (#486) #487 lands, since feat(videodecoder): add setPixelAspectRatio() and clarify hint precedence + persistence (#486) #487 establishes the precedence and persistence rules that Surface 1 and Surface 2 inherit.
- Audio-side equivalent should be considered in parallel — same pattern likely applies for
audiodecoder(ad with different audio codec / channel count) andaudiomixer(input format changes).
cc @shafi12 @hari22yuva @srinivasgtl — happy to raise the tracking issue. Any objections to the shape above before I do?
|
Closing — design agreed across the comments above; no objections from cc'd reviewers in three weeks. Agreed shape:
Implementation tracked under #539 against milestone 0.22.0. Depends on #487 landing first (the precedence and persistence rules for the individual setters that Surface 1 and Surface 2 inherit). Further design refinement can happen in the issue thread. |
Uh oh!
There was an error while loading. Please reload this page.
Currently, the client configures VideoDecoder properties using multiple individual Binder calls, such as:
setMasteringDisplayInfo
setContentLightLevel
setColorimetry
setStreamResolution
setFrameRate
setDolbyVisionLayerFlags
setPixelAspectRatio
Dynamic range–related setters
Each of these APIs results in a separate Binder transaction between the client and server. This increases IPC overhead and introduces the risk of partial or inconsistent VideoDecoder state during configuration and reconfiguration.
Proposed Solution
Introduce a single atomic VideoDecoder‑level API that allows all related properties to be set in one Binder call.
Plain Textaidl isn’t fully supported. Syntax highlighting is based on Plain Text.boolean setPropertyMultiAtomic( in int VideoDecoderResourceIndex, in PropertyKVPair[] propertyKVListShow more lines
VideoDecoderResourceIndex identifies the target VideoDecoder instance
propertyKVList contains all VideoDecoder‑specific properties such as HDR metadata, colour information, stream resolution, frame rate, Dolby Vision layer flags, pixel aspect ratio, and dynamic range information
This consolidates multiple setter calls into one Binder transaction.
All reactions