1

我正在尝试解析 Widevine PSSH 数据并读取其内容。这是取自https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd的 PSSH 数据示例

AAAAR3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAACcIARIBMBoNd2lkZXZpbmVfdGVzdCIKMjAxNV90ZWFycyoFQVVESU8=

我以这种方式创建原始消息

syntax = "proto2";

package drm;

option java_package = "com.drm.widevine";
option java_outer_classname = "WidevineCenc";

message WidevinePsshData {
    enum Algorithm {
        UNENCRYPTED = 0 ;
        AESCTR = 1 ;
    };
    optional Algorithm algorithm = 1 ;
    repeated bytes key_id = 2 ;
    // Content provider name.
    optional string provider = 3 ;
    // A content identifier, specified by content provider.
    optional bytes content_id = 4 ;
    // Track type. Acceptable values are SD, HD and AUDIO. Used to
    // differentiate content keys used by an asset.
    optional string track_type = 5 ;
    // The name of a registered policy to be used for this asset.
    optional string policy = 6 ;
    // Crypto period index, for media using key rotation.
    optional uint32 crypto_period_index = 7;
}

我尝试反序列化 pssh-data 如下

String psshString = "AAAAR3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAACcIARIBMBoNd2lkZXZpbmVfdGVzdCIKMjAxNV90ZWFycyoFQVVESU8=";
byte[] data = Base64.decode(psshString, Base64.DEFAULT);
WidevineCenc.WidevinePsshData pssh = WidevineCenc.WidevinePsshData.parseFrom(data);

我收到这个错误

com.google.protobuf.InvalidProtocolBufferException:协议消息包含无效标签(零)。

4

0 回答 0