Fix Windows build break (#217)

Change-Id: Id0a00c01077adb97f294c68357b629441321e6c7
This commit is contained in:
Kongqun Yang 2017-03-24 10:21:05 -07:00 committed by GitHub
parent 277c5b23c0
commit bc4c511ad4
3 changed files with 9 additions and 8 deletions

View File

@ -190,6 +190,8 @@ bool NalUnitToByteStreamConverter::ConvertUnitToByteStreamWithSubsamples(
buffer_writer.AppendVector(decoder_configuration_in_byte_stream_);
int adjustment = static_cast<int>(buffer_writer.Size());
const int start_code_size_adjustment =
arraysize(kNaluStartCode) - nalu_length_size_;
size_t subsample_id = 0;
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);
subsamples->at(subsample_id).clear_bytes -=
static_cast<uint16_t>(old_nalu_size);
adjustment += static_cast<int>(old_nalu_size) +
arraysize(kNaluStartCode) - nalu_length_size_;
adjustment +=
static_cast<int>(old_nalu_size) + start_code_size_adjustment;
} else {
if (escape_encrypted_nalu)
escape_data = subsamples->at(subsample_id).cipher_bytes != 0;
// Apply the adjustment on the current subsample, reset the
// adjustment and move to the next subsample.
subsamples->at(subsample_id).clear_bytes +=
adjustment + arraysize(kNaluStartCode) - nalu_length_size_;
adjustment + start_code_size_adjustment;
subsample_id++;
adjustment = 0;
}

View File

@ -239,8 +239,8 @@ Status Fragmenter::FinalizeFragmentForEncryption() {
!sample_encryption_entry.subsamples.empty();
if (use_subsample_encryption)
traf_->sample_encryption.flags |= SampleEncryption::kUseSubsampleEncryption;
traf_->sample_encryption.iv_size =
sample_encryption_entry.initialization_vector.size();
traf_->sample_encryption.iv_size = static_cast<uint8_t>(
sample_encryption_entry.initialization_vector.size());
// The offset will be adjusted in Segmenter after knowing moof size.
traf_->auxiliary_offset.offsets.push_back(0);

View File

@ -38,11 +38,10 @@ TEST(EncryptionUtilTest, UpdateTrack) {
}
TEST(EncryptionUtilTest, UpdateTrackWithEmptyKeyId) {
const uint8_t kKeyId[] = {};
unsigned int seed = 0;
mkvmuxer::VideoTrack video_track(&seed);
Status status = UpdateTrackForEncryption(
std::vector<uint8_t>(kKeyId, kKeyId + sizeof(kKeyId)), &video_track);
const std::vector<uint8_t> empty_key_id;
Status status = UpdateTrackForEncryption(empty_key_id, &video_track);
EXPECT_EQ(error::INTERNAL_ERROR, status.error_code());
}