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 "media/formats/mp2t/ts_section_pes.h" | 5 #include "media/formats/mp2t/ts_section_pes.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 RCHECK(bit_reader.ReadBits(40, &dts_section)); | 215 RCHECK(bit_reader.ReadBits(40, &dts_section)); |
216 RCHECK((((pts_section >> 36) & 0xf) == 0x3) && | 216 RCHECK((((pts_section >> 36) & 0xf) == 0x3) && |
217 IsTimestampSectionValid(pts_section)); | 217 IsTimestampSectionValid(pts_section)); |
218 RCHECK((((dts_section >> 36) & 0xf) == 0x1) && | 218 RCHECK((((dts_section >> 36) & 0xf) == 0x1) && |
219 IsTimestampSectionValid(dts_section)); | 219 IsTimestampSectionValid(dts_section)); |
220 is_pts_valid = true; | 220 is_pts_valid = true; |
221 is_dts_valid = true; | 221 is_dts_valid = true; |
222 } | 222 } |
223 | 223 |
224 // Convert and unroll the timestamps. | 224 // Convert and unroll the timestamps. |
225 base::TimeDelta media_pts(kNoTimestamp()); | 225 base::TimeDelta media_pts(kNoTimestamp); |
226 DecodeTimestamp media_dts(kNoDecodeTimestamp()); | 226 DecodeTimestamp media_dts(kNoDecodeTimestamp()); |
227 if (is_pts_valid) { | 227 if (is_pts_valid) { |
228 int64_t pts = timestamp_unroller_->GetUnrolledTimestamp( | 228 int64_t pts = timestamp_unroller_->GetUnrolledTimestamp( |
229 ConvertTimestampSectionToTimestamp(pts_section)); | 229 ConvertTimestampSectionToTimestamp(pts_section)); |
230 media_pts = base::TimeDelta::FromMicroseconds((1000 * pts) / 90); | 230 media_pts = base::TimeDelta::FromMicroseconds((1000 * pts) / 90); |
231 } | 231 } |
232 if (is_dts_valid) { | 232 if (is_dts_valid) { |
233 int64_t dts = timestamp_unroller_->GetUnrolledTimestamp( | 233 int64_t dts = timestamp_unroller_->GetUnrolledTimestamp( |
234 ConvertTimestampSectionToTimestamp(dts_section)); | 234 ConvertTimestampSectionToTimestamp(dts_section)); |
235 media_dts = DecodeTimestamp::FromMicroseconds((1000 * dts) / 90); | 235 media_dts = DecodeTimestamp::FromMicroseconds((1000 * dts) / 90); |
(...skipping 16 matching lines...) Expand all Loading... |
252 return es_parser_->Parse(&raw_pes[es_offset], es_size, media_pts, media_dts); | 252 return es_parser_->Parse(&raw_pes[es_offset], es_size, media_pts, media_dts); |
253 } | 253 } |
254 | 254 |
255 void TsSectionPes::ResetPesState() { | 255 void TsSectionPes::ResetPesState() { |
256 pes_byte_queue_.Reset(); | 256 pes_byte_queue_.Reset(); |
257 wait_for_pusi_ = true; | 257 wait_for_pusi_ = true; |
258 } | 258 } |
259 | 259 |
260 } // namespace mp2t | 260 } // namespace mp2t |
261 } // namespace media | 261 } // namespace media |
OLD | NEW |