diff options
Diffstat (limited to 'chromium/media/video/h264_bit_reader.cc')
-rw-r--r-- | chromium/media/video/h264_bit_reader.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/chromium/media/video/h264_bit_reader.cc b/chromium/media/video/h264_bit_reader.cc index 45c3d75c00c..dd7ce6581c8 100644 --- a/chromium/media/video/h264_bit_reader.cc +++ b/chromium/media/video/h264_bit_reader.cc @@ -1,4 +1,4 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -71,7 +71,8 @@ bool H264BitReader::ReadBits(int num_bits, int* out) { while (num_remaining_bits_in_curr_byte_ < bits_left) { // Take all that's left in current byte, shift to make space for the rest. - *out |= (curr_byte_ << (bits_left - num_remaining_bits_in_curr_byte_)); + *out |= ((curr_byte_ & ((1u << num_remaining_bits_in_curr_byte_) - 1u)) + << (bits_left - num_remaining_bits_in_curr_byte_)); bits_left -= num_remaining_bits_in_curr_byte_; if (!UpdateCurrByte()) |