Bug 237966

Summary: [iOS] WebAVMediaSelectionOption should implement -mediaType
Product: WebKit Reporter: Eric Carlson <eric.carlson>
Component: MediaAssignee: Eric Carlson <eric.carlson>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, glenn, jer.noble, philipj, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 239686    
Attachments:
Description Flags
Patch
none
Patch for landing none

Description Eric Carlson 2022-03-16 09:22:41 PDT
WebAVMediaSelectionOption should implement -mediaType
Comment 1 Eric Carlson 2022-03-16 09:22:49 PDT
rdar://89934589
Comment 2 Eric Carlson 2022-03-16 09:48:27 PDT
Created attachment 454849 [details]
Patch
Comment 3 Jer Noble 2022-03-16 10:06:00 PDT
Comment on attachment 454849 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=454849&action=review

> Source/WebCore/platform/MediaSelectionOption.h:87
> +template<class Decoder> std::optional<MediaSelectionOption> MediaSelectionOption::decode(Decoder& decoder)
> +{
> +    MediaSelectionOption option;
> +
> +    if (!decoder.decode(option.mediaType))
> +        return { };
> +
> +    if (!decoder.decode(option.displayName))
> +        return { };
> +
> +    if (!decoder.decode(option.legibleType))
> +        return { };
> +
> +    return option;
> +}

Nit: this could be:

template<class Decoder> bool MediaSelectionOption::decode(Decoder& decoder, MediaSelectionOption& option)
{
    return decoder.decode(option.mediaType)
        && decoder.decode(option.displayName)
        && decoder.decode(option.legibleType);
}

Slightly more compact. No hard evidence if this is true or not, but my intuition says it's slightly more efficient as well.
Comment 4 Eric Carlson 2022-03-16 10:16:19 PDT
Created attachment 454852 [details]
Patch for landing
Comment 5 EWS 2022-03-16 13:30:32 PDT
Committed r291361 (248493@main): <https://commits.webkit.org/248493@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 454852 [details].