From 03d7a81c8320abeda211ea7c4c008001ba0676d6 Mon Sep 17 00:00:00 2001 From: Haoming Chen Date: Thu, 8 Sep 2016 17:19:11 -0700 Subject: [PATCH] Fix a precision conversion problem. - This causes a compilation error on Windows. Change-Id: I53c03841565be00ebaa3acbfe621bb145f8f1ca2 --- .../media/codecs/nal_unit_to_byte_stream_converter.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packager/media/codecs/nal_unit_to_byte_stream_converter.cc b/packager/media/codecs/nal_unit_to_byte_stream_converter.cc index 32c8fb7ddb..612ca1f5dd 100644 --- a/packager/media/codecs/nal_unit_to_byte_stream_converter.cc +++ b/packager/media/codecs/nal_unit_to_byte_stream_converter.cc @@ -219,7 +219,9 @@ bool NalUnitToByteStreamConverter::ConvertUnitToByteStreamWithSubsamples( } if (is_nalu_all_clear) { // If AUD/SPS/PPS is all clear, reduce the clear bytes. - subsamples->at(subsample_id).clear_bytes -= old_nalu_size; + DCHECK_LT(old_nalu_size, subsamples->at(subsample_id).clear_bytes); + subsamples->at(subsample_id).clear_bytes -= + static_cast(old_nalu_size); } else { // If AUD/SPS/PPS has cipher, drop the corresponding subsample. subsamples->erase(subsamples->begin() + subsample_id); @@ -240,7 +242,9 @@ bool NalUnitToByteStreamConverter::ConvertUnitToByteStreamWithSubsamples( } if (is_nalu_all_clear) { // Add this nalu to the adjustment and remove it from clear_bytes. - subsamples->at(subsample_id).clear_bytes -= old_nalu_size; + DCHECK_LT(old_nalu_size, subsamples->at(subsample_id).clear_bytes); + subsamples->at(subsample_id).clear_bytes -= + static_cast(old_nalu_size); adjustment += old_nalu_size; } else { // Apply the adjustment on the current subsample, reset the