Changeset 175615 in webkit


Ignore:
Timestamp:
Nov 5, 2014 1:56:37 AM (9 years ago)
Author:
jer.noble@apple.com
Message:

[EME][Mac] Allow the client to specify FPS protocol versions in the keySystem type field.
https://bugs.webkit.org/show_bug.cgi?id=138380

Reviewed by Eric Carlson.

Parse out the requested FPS protocol version of the keySystem type string and pass it to
AVStreamDataParser as an options dictionary.

  • platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:

(WebCore::validKeySystemRE): Added, match comma-separated version suffixes.
(WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystem): Call above.
(WebCore::CDMPrivateMediaSourceAVFObjC::createSession): Parse out the version numbers

and pass into the session as a vector.

  • platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
  • platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:

(WebCore::CDMSessionMediaSourceAVFObjC::CDMSessionMediaSourceAVFObjC): Take a vector of

protocol version numbers.

(WebCore::CDMSessionMediaSourceAVFObjC::update): Create an NSArray and pass into

the key request creation method in an options dictionary.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r175614 r175615  
     12014-11-05  Jer Noble  <jer.noble@apple.com>
     2
     3        [EME][Mac] Allow the client to specify FPS protocol versions in the keySystem type field.
     4        https://bugs.webkit.org/show_bug.cgi?id=138380
     5
     6        Reviewed by Eric Carlson.
     7
     8        Parse out the requested FPS protocol version of the keySystem type string and pass it to
     9        AVStreamDataParser as an options dictionary.
     10
     11        * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
     12        (WebCore::validKeySystemRE): Added, match comma-separated version suffixes.
     13        (WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystem): Call above.
     14        (WebCore::CDMPrivateMediaSourceAVFObjC::createSession): Parse out the version numbers
     15            and pass into the session as a vector.
     16        * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
     17        * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
     18        (WebCore::CDMSessionMediaSourceAVFObjC::CDMSessionMediaSourceAVFObjC): Take a vector of
     19            protocol version numbers.
     20        (WebCore::CDMSessionMediaSourceAVFObjC::update): Create an NSArray and pass into
     21            the key request creation method in an options dictionary.
     22
    1232014-11-05  Antti Koivisto  <antti@apple.com>
    224
  • trunk/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm

    r175331 r175615  
    3535#import "MediaPlayerPrivateMediaSourceAVFObjC.h"
    3636#import "WebCoreSystemInterface.h"
     37#import <wtf/NeverDestroyed.h>
     38#import <yarr/RegularExpression.h>
     39
     40using JSC::Yarr::RegularExpression;
    3741
    3842namespace WebCore {
     43
     44static RegularExpression& validKeySystemRE()
     45{
     46    static NeverDestroyed<RegularExpression> keySystemRE("^com\\.apple\\.fps\\.2_\\d+(?:,\\d+)*$", TextCaseInsensitive);
     47    return keySystemRE;
     48}
    3949
    4050bool CDMPrivateMediaSourceAVFObjC::supportsKeySystem(const String& keySystem)
     
    4353        return false;
    4454
    45     if (!keySystem.isEmpty() && !equalIgnoringCase(keySystem, "com.apple.fps.2_0"))
     55    if (!keySystem.isEmpty() && validKeySystemRE().match(keySystem) < 0)
    4656        return false;
    4757
     
    8292std::unique_ptr<CDMSession> CDMPrivateMediaSourceAVFObjC::createSession()
    8393{
    84     return std::make_unique<CDMSessionMediaSourceAVFObjC>();
     94    String keySystem = m_cdm->keySystem();
     95    ASSERT(validKeySystemRE().match(keySystem) >= 0);
     96
     97    Vector<String> protocolVersionsStrings;
     98    keySystem.substring(16).split(',', false, protocolVersionsStrings);
     99
     100    Vector<int> protocolVersions;
     101    for (auto& protocolVersionString : protocolVersionsStrings)
     102        protocolVersions.append(protocolVersionString.toInt());
     103
     104    return std::make_unique<CDMSessionMediaSourceAVFObjC>(protocolVersions);
    85105}
    86106
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h

    r175000 r175615  
    4141class CDMSessionMediaSourceAVFObjC : public CDMSession, public SourceBufferPrivateAVFObjCErrorClient {
    4242public:
    43     CDMSessionMediaSourceAVFObjC();
     43    CDMSessionMediaSourceAVFObjC(const Vector<int>& protocolVersions);
    4444    virtual ~CDMSessionMediaSourceAVFObjC();
    4545
     
    7171    RetainPtr<NSData> m_expiredSession;
    7272    RetainPtr<CDMSessionMediaSourceAVFObjCObserver> m_dataParserObserver;
     73    Vector<int> m_protocolVersions;
    7374    String m_sessionId;
    7475    enum { Normal, KeyRelease } m_mode;
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm

    r175331 r175615  
    4646SOFT_LINK_CLASS(AVFoundation, AVStreamDataParser);
    4747SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVStreamSession);
    48 SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVStreamSessionContentProtectionSessionIdentifierChangedNotification, NSString *);
     48SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVStreamDataParserContentKeyRequestProtocolVersionsKey, NSString *)
     49SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVStreamSessionContentProtectionSessionIdentifierChangedNotification, NSString *)
    4950
    5051@interface AVStreamDataParser : NSObject
     
    9394namespace WebCore {
    9495
    95 CDMSessionMediaSourceAVFObjC::CDMSessionMediaSourceAVFObjC()
     96CDMSessionMediaSourceAVFObjC::CDMSessionMediaSourceAVFObjC(const Vector<int>& protocolVersions)
    9697    : m_client(nullptr)
    9798    , m_dataParserObserver(adoptNS([[CDMSessionMediaSourceAVFObjCObserver alloc] initWithParent:this]))
     99    , m_protocolVersions(protocolVersions)
    98100    , m_mode(Normal)
    99101{
     
    220222        RetainPtr<NSData> initData = adoptNS([[NSData alloc] initWithBytes:m_initData->data() length:m_initData->length()]);
    221223
     224
     225        RetainPtr<NSDictionary> options;
     226        if (!m_protocolVersions.isEmpty() && canLoadAVStreamDataParserContentKeyRequestProtocolVersionsKey()) {
     227            RetainPtr<NSMutableArray> protocolVersionsOption = adoptNS([[NSMutableArray alloc] init]);
     228            for (auto& version : m_protocolVersions) {
     229                if (!version)
     230                    continue;
     231                [protocolVersionsOption addObject:@(version)];
     232            }
     233
     234            options = @{ getAVStreamDataParserContentKeyRequestProtocolVersionsKey(): protocolVersionsOption.get() };
     235        }
     236
    222237        NSError* error = nil;
    223         RetainPtr<NSData> request = [protectedSourceBuffer->parser() streamingContentKeyRequestDataForApp:certificateData.get() contentIdentifier:initData.get() trackID:protectedSourceBuffer->protectedTrackID() options:nil error:&error];
     238        RetainPtr<NSData> request = [protectedSourceBuffer->parser() streamingContentKeyRequestDataForApp:certificateData.get() contentIdentifier:initData.get() trackID:protectedSourceBuffer->protectedTrackID() options:options.get() error:&error];
    224239
    225240        if (![protectedSourceBuffer->parser() respondsToSelector:@selector(contentProtectionSessionIdentifier)])
Note: See TracChangeset for help on using the changeset viewer.