44 Status
Process(std::unique_ptr<StreamData> stream_data)
override;
48 friend class EncryptionHandlerTest;
54 Status ProcessStreamInfo(
const StreamInfo& stream_info);
56 Status ProcessMediaSample(std::shared_ptr<const MediaSample> clear_sample);
58 void SetupProtectionPattern(StreamType stream_type, Codec codec);
62 bool SampleAesEncryptEac3Frame(
const uint8_t* source,
67 void EncryptBytes(
const uint8_t* source,
75 bool ExtractEac3SyncframeSizes(
const uint8_t* source,
77 std::vector<size_t>* syncframe_sizes);
80 void InjectSubsampleGeneratorForTesting(
81 std::unique_ptr<SubsampleGenerator> generator);
82 void InjectEncryptorFactoryForTesting(
83 std::unique_ptr<AesEncryptorFactory> encryptor_factory);
85 const EncryptionParams encryption_params_;
86 const FourCC protection_scheme_ = FOURCC_NULL;
88 std::string stream_label_;
90 std::shared_ptr<EncryptionConfig> encryption_config_;
91 std::unique_ptr<AesCryptor> encryptor_;
92 Codec codec_ = kUnknownCodec;
94 int64_t remaining_clear_lead_ = 0;
96 int64_t crypto_period_duration_ = 0;
98 int64_t prev_crypto_period_index_ = -1;
99 bool check_new_crypto_period_ =
false;
101 std::unique_ptr<SubsampleGenerator> subsample_generator_;
102 std::unique_ptr<AesEncryptorFactory> encryptor_factory_;
104 uint8_t crypt_byte_block_ = 0;
106 uint8_t skip_byte_block_ = 0;