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/mp4/mp4_stream_parser.h" | 5 #include "media/formats/mp4/mp4_stream_parser.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "media/base/audio_decoder_config.h" | 10 #include "media/base/audio_decoder_config.h" |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 decrypt_config.reset( | 509 decrypt_config.reset( |
510 new DecryptConfig("1", "", std::vector<SubsampleEntry>())); | 510 new DecryptConfig("1", "", std::vector<SubsampleEntry>())); |
511 } | 511 } |
512 | 512 |
513 StreamParserBuffer::Type buffer_type = audio ? DemuxerStream::AUDIO : | 513 StreamParserBuffer::Type buffer_type = audio ? DemuxerStream::AUDIO : |
514 DemuxerStream::VIDEO; | 514 DemuxerStream::VIDEO; |
515 | 515 |
516 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId | 516 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId |
517 // type and allow multiple tracks for same media type, if applicable. See | 517 // type and allow multiple tracks for same media type, if applicable. See |
518 // https://crbug.com/341581. | 518 // https://crbug.com/341581. |
519 // | |
520 // NOTE: MPEG's "random access point" concept is equivalent to the | |
521 // downstream code's "is keyframe" concept. | |
522 scoped_refptr<StreamParserBuffer> stream_buf = | 519 scoped_refptr<StreamParserBuffer> stream_buf = |
523 StreamParserBuffer::CopyFrom(&frame_buf[0], frame_buf.size(), | 520 StreamParserBuffer::CopyFrom(&frame_buf[0], frame_buf.size(), |
524 runs_->is_random_access_point(), | 521 runs_->is_keyframe(), |
525 buffer_type, 0); | 522 buffer_type, 0); |
526 | 523 |
527 if (decrypt_config) | 524 if (decrypt_config) |
528 stream_buf->set_decrypt_config(decrypt_config.Pass()); | 525 stream_buf->set_decrypt_config(decrypt_config.Pass()); |
529 | 526 |
530 stream_buf->set_duration(runs_->duration()); | 527 stream_buf->set_duration(runs_->duration()); |
531 stream_buf->set_timestamp(runs_->cts()); | 528 stream_buf->set_timestamp(runs_->cts()); |
532 stream_buf->SetDecodeTimestamp(runs_->dts()); | 529 stream_buf->SetDecodeTimestamp(runs_->dts()); |
533 | 530 |
534 DVLOG(3) << "Pushing frame: aud=" << audio | 531 DVLOG(3) << "Pushing frame: aud=" << audio |
535 << ", key=" << runs_->is_keyframe() | 532 << ", key=" << runs_->is_keyframe() |
536 << ", rap=" << runs_->is_random_access_point() | |
537 << ", dur=" << runs_->duration().InMilliseconds() | 533 << ", dur=" << runs_->duration().InMilliseconds() |
538 << ", dts=" << runs_->dts().InMilliseconds() | 534 << ", dts=" << runs_->dts().InMilliseconds() |
539 << ", cts=" << runs_->cts().InMilliseconds() | 535 << ", cts=" << runs_->cts().InMilliseconds() |
540 << ", size=" << runs_->sample_size(); | 536 << ", size=" << runs_->sample_size(); |
541 | 537 |
542 if (audio) { | 538 if (audio) { |
543 audio_buffers->push_back(stream_buf); | 539 audio_buffers->push_back(stream_buf); |
544 } else { | 540 } else { |
545 video_buffers->push_back(stream_buf); | 541 video_buffers->push_back(stream_buf); |
546 } | 542 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 runs.AdvanceSample(); | 619 runs.AdvanceSample(); |
624 } | 620 } |
625 runs.AdvanceRun(); | 621 runs.AdvanceRun(); |
626 } | 622 } |
627 | 623 |
628 return true; | 624 return true; |
629 } | 625 } |
630 | 626 |
631 } // namespace mp4 | 627 } // namespace mp4 |
632 } // namespace media | 628 } // namespace media |
OLD | NEW |