Bug 130919 - [MSE][Mac] Support lease-renewal.
Summary: [MSE][Mac] Support lease-renewal.
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
Depends on:
Reported: 2014-03-28 16:50 PDT by Jer Noble
Modified: 2014-03-31 10:01 PDT (History)
5 users (show)

See Also:

Patch (2.88 KB, patch)
2014-03-28 16:54 PDT, Jer Noble
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jer Noble 2014-03-28 16:50:07 PDT
[MSE][Mac] Support lease-renewal.
Comment 1 Jer Noble 2014-03-28 16:54:58 PDT
Created attachment 228093 [details]
Comment 2 WebKit Commit Bot 2014-03-31 09:43:58 PDT
Comment on attachment 228093 [details]

Clearing flags on attachment: 228093

Committed r166509: <http://trac.webkit.org/changeset/166509>
Comment 3 WebKit Commit Bot 2014-03-31 09:44:01 PDT
All reviewed patches have been landed.  Closing bug.
Comment 4 Darin Adler 2014-03-31 10:01:26 PDT
Comment on attachment 228093 [details]

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

> Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:116
> +    static NeverDestroyed<String> renewMessage("renew");
> +    String keyAsString(key->data(), key->length());
> +
> +    if (keyAsString == renewMessage) {

This is a tortured way to check if the key is "renew". I suggest writing a function to do it without memory allocation. Maybe put it in a header somewhere, but at least do it within this file for now:

    static bool isEqual(const uint8_t* data, unsigned length, const char* literal)
        for (unsigned i = 0; i < length; ++i) {
            if (data[i] != static_cast<uint8_t>(literal[i]))
                return false;
        return !literal[length];

Then get rid of the renewMessage and keyAsStringLocal variables. And write:

    if (isEqual(key->data(), key->length(), "renew") {