| 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/es_parser_h264.h" | 5 #include "media/formats/mp2t/es_parser_h264.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "media/base/bit_reader.h" | 9 #include "media/base/bit_reader.h" |
| 10 #include "media/base/buffers.h" | 10 #include "media/base/buffers.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 241 } |
| 242 | 242 |
| 243 if (current_timing_desc.pts == kNoTimestamp()) | 243 if (current_timing_desc.pts == kNoTimestamp()) |
| 244 return false; | 244 return false; |
| 245 | 245 |
| 246 // Emit a frame. | 246 // Emit a frame. |
| 247 int raw_es_size; | 247 int raw_es_size; |
| 248 const uint8* raw_es; | 248 const uint8* raw_es; |
| 249 es_byte_queue_.Peek(&raw_es, &raw_es_size); | 249 es_byte_queue_.Peek(&raw_es, &raw_es_size); |
| 250 int access_unit_size = next_aud_pos - current_access_unit_pos_; | 250 int access_unit_size = next_aud_pos - current_access_unit_pos_; |
| 251 |
| 252 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId |
| 253 // type and allow multiple video tracks. See https://crbug.com/341581. |
| 251 scoped_refptr<StreamParserBuffer> stream_parser_buffer = | 254 scoped_refptr<StreamParserBuffer> stream_parser_buffer = |
| 252 StreamParserBuffer::CopyFrom( | 255 StreamParserBuffer::CopyFrom( |
| 253 &raw_es[current_access_unit_pos_], | 256 &raw_es[current_access_unit_pos_], |
| 254 access_unit_size, | 257 access_unit_size, |
| 255 is_key_frame_); | 258 is_key_frame_, |
| 259 DemuxerStream::VIDEO, |
| 260 0); |
| 256 stream_parser_buffer->SetDecodeTimestamp(current_timing_desc.dts); | 261 stream_parser_buffer->SetDecodeTimestamp(current_timing_desc.dts); |
| 257 stream_parser_buffer->set_timestamp(current_timing_desc.pts); | 262 stream_parser_buffer->set_timestamp(current_timing_desc.pts); |
| 258 emit_buffer_cb_.Run(stream_parser_buffer); | 263 emit_buffer_cb_.Run(stream_parser_buffer); |
| 259 | 264 |
| 260 // Set the current frame position to the next AUD position. | 265 // Set the current frame position to the next AUD position. |
| 261 StartFrame(next_aud_pos); | 266 StartFrame(next_aud_pos); |
| 262 return true; | 267 return true; |
| 263 } | 268 } |
| 264 | 269 |
| 265 void EsParserH264::StartFrame(int aud_pos) { | 270 void EsParserH264::StartFrame(int aud_pos) { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 last_video_decoder_config_ = video_decoder_config; | 531 last_video_decoder_config_ = video_decoder_config; |
| 527 new_video_config_cb_.Run(video_decoder_config); | 532 new_video_config_cb_.Run(video_decoder_config); |
| 528 } | 533 } |
| 529 | 534 |
| 530 return true; | 535 return true; |
| 531 } | 536 } |
| 532 | 537 |
| 533 } // namespace mp2t | 538 } // namespace mp2t |
| 534 } // namespace media | 539 } // namespace media |
| 535 | 540 |
| OLD | NEW |