| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "media/filters/h264_bit_reader.h" | 6 #include "media/filters/h264_bit_reader.h" |
| 7 | 7 |
| 8 namespace media { | 8 namespace media { |
| 9 | 9 |
| 10 H264BitReader::H264BitReader() | 10 H264BitReader::H264BitReader() |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 while (num_remaining_bits_in_curr_byte_ < bits_left) { | 72 while (num_remaining_bits_in_curr_byte_ < bits_left) { |
| 73 // Take all that's left in current byte, shift to make space for the rest. | 73 // Take all that's left in current byte, shift to make space for the rest. |
| 74 *out |= (curr_byte_ << (bits_left - num_remaining_bits_in_curr_byte_)); | 74 *out |= (curr_byte_ << (bits_left - num_remaining_bits_in_curr_byte_)); |
| 75 bits_left -= num_remaining_bits_in_curr_byte_; | 75 bits_left -= num_remaining_bits_in_curr_byte_; |
| 76 | 76 |
| 77 if (!UpdateCurrByte()) | 77 if (!UpdateCurrByte()) |
| 78 return false; | 78 return false; |
| 79 } | 79 } |
| 80 | 80 |
| 81 *out |= (curr_byte_ >> (num_remaining_bits_in_curr_byte_ - bits_left)); | 81 *out |= (curr_byte_ >> (num_remaining_bits_in_curr_byte_ - bits_left)); |
| 82 *out &= ((1 << num_bits) - 1); | 82 *out &= ((1u << num_bits) - 1u); |
| 83 num_remaining_bits_in_curr_byte_ -= bits_left; | 83 num_remaining_bits_in_curr_byte_ -= bits_left; |
| 84 | 84 |
| 85 return true; | 85 return true; |
| 86 } | 86 } |
| 87 | 87 |
| 88 off_t H264BitReader::NumBitsLeft() { | 88 off_t H264BitReader::NumBitsLeft() { |
| 89 return (num_remaining_bits_in_curr_byte_ + bytes_left_ * 8); | 89 return (num_remaining_bits_in_curr_byte_ + bytes_left_ * 8); |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool H264BitReader::HasMoreRBSPData() { | 92 bool H264BitReader::HasMoreRBSPData() { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 113 | 113 |
| 114 bytes_left_ = 0; | 114 bytes_left_ = 0; |
| 115 return false; | 115 return false; |
| 116 } | 116 } |
| 117 | 117 |
| 118 size_t H264BitReader::NumEmulationPreventionBytesRead() { | 118 size_t H264BitReader::NumEmulationPreventionBytesRead() { |
| 119 return emulation_prevention_bytes_; | 119 return emulation_prevention_bytes_; |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace media | 122 } // namespace media |
| OLD | NEW |