Fix Windows build break (#217)
Change-Id: Id0a00c01077adb97f294c68357b629441321e6c7
This commit is contained in:
parent
277c5b23c0
commit
bc4c511ad4
|
@ -190,6 +190,8 @@ bool NalUnitToByteStreamConverter::ConvertUnitToByteStreamWithSubsamples(
|
||||||
buffer_writer.AppendVector(decoder_configuration_in_byte_stream_);
|
buffer_writer.AppendVector(decoder_configuration_in_byte_stream_);
|
||||||
|
|
||||||
int adjustment = static_cast<int>(buffer_writer.Size());
|
int adjustment = static_cast<int>(buffer_writer.Size());
|
||||||
|
const int start_code_size_adjustment =
|
||||||
|
arraysize(kNaluStartCode) - nalu_length_size_;
|
||||||
size_t subsample_id = 0;
|
size_t subsample_id = 0;
|
||||||
|
|
||||||
NaluReader nalu_reader(Nalu::kH264, nalu_length_size_, sample, sample_size);
|
NaluReader nalu_reader(Nalu::kH264, nalu_length_size_, sample, sample_size);
|
||||||
|
@ -237,15 +239,15 @@ bool NalUnitToByteStreamConverter::ConvertUnitToByteStreamWithSubsamples(
|
||||||
DCHECK_LT(old_nalu_size, subsamples->at(subsample_id).clear_bytes);
|
DCHECK_LT(old_nalu_size, subsamples->at(subsample_id).clear_bytes);
|
||||||
subsamples->at(subsample_id).clear_bytes -=
|
subsamples->at(subsample_id).clear_bytes -=
|
||||||
static_cast<uint16_t>(old_nalu_size);
|
static_cast<uint16_t>(old_nalu_size);
|
||||||
adjustment += static_cast<int>(old_nalu_size) +
|
adjustment +=
|
||||||
arraysize(kNaluStartCode) - nalu_length_size_;
|
static_cast<int>(old_nalu_size) + start_code_size_adjustment;
|
||||||
} else {
|
} else {
|
||||||
if (escape_encrypted_nalu)
|
if (escape_encrypted_nalu)
|
||||||
escape_data = subsamples->at(subsample_id).cipher_bytes != 0;
|
escape_data = subsamples->at(subsample_id).cipher_bytes != 0;
|
||||||
// Apply the adjustment on the current subsample, reset the
|
// Apply the adjustment on the current subsample, reset the
|
||||||
// adjustment and move to the next subsample.
|
// adjustment and move to the next subsample.
|
||||||
subsamples->at(subsample_id).clear_bytes +=
|
subsamples->at(subsample_id).clear_bytes +=
|
||||||
adjustment + arraysize(kNaluStartCode) - nalu_length_size_;
|
adjustment + start_code_size_adjustment;
|
||||||
subsample_id++;
|
subsample_id++;
|
||||||
adjustment = 0;
|
adjustment = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,8 +239,8 @@ Status Fragmenter::FinalizeFragmentForEncryption() {
|
||||||
!sample_encryption_entry.subsamples.empty();
|
!sample_encryption_entry.subsamples.empty();
|
||||||
if (use_subsample_encryption)
|
if (use_subsample_encryption)
|
||||||
traf_->sample_encryption.flags |= SampleEncryption::kUseSubsampleEncryption;
|
traf_->sample_encryption.flags |= SampleEncryption::kUseSubsampleEncryption;
|
||||||
traf_->sample_encryption.iv_size =
|
traf_->sample_encryption.iv_size = static_cast<uint8_t>(
|
||||||
sample_encryption_entry.initialization_vector.size();
|
sample_encryption_entry.initialization_vector.size());
|
||||||
|
|
||||||
// The offset will be adjusted in Segmenter after knowing moof size.
|
// The offset will be adjusted in Segmenter after knowing moof size.
|
||||||
traf_->auxiliary_offset.offsets.push_back(0);
|
traf_->auxiliary_offset.offsets.push_back(0);
|
||||||
|
|
|
@ -38,11 +38,10 @@ TEST(EncryptionUtilTest, UpdateTrack) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(EncryptionUtilTest, UpdateTrackWithEmptyKeyId) {
|
TEST(EncryptionUtilTest, UpdateTrackWithEmptyKeyId) {
|
||||||
const uint8_t kKeyId[] = {};
|
|
||||||
unsigned int seed = 0;
|
unsigned int seed = 0;
|
||||||
mkvmuxer::VideoTrack video_track(&seed);
|
mkvmuxer::VideoTrack video_track(&seed);
|
||||||
Status status = UpdateTrackForEncryption(
|
const std::vector<uint8_t> empty_key_id;
|
||||||
std::vector<uint8_t>(kKeyId, kKeyId + sizeof(kKeyId)), &video_track);
|
Status status = UpdateTrackForEncryption(empty_key_id, &video_track);
|
||||||
EXPECT_EQ(error::INTERNAL_ERROR, status.error_code());
|
EXPECT_EQ(error::INTERNAL_ERROR, status.error_code());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue