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.h" | 7 #include "base/callback.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 } | 490 } |
491 // else, use the existing config. | 491 // else, use the existing config. |
492 } else if ((audio && is_audio_track_encrypted_) || | 492 } else if ((audio && is_audio_track_encrypted_) || |
493 (video && is_video_track_encrypted_)) { | 493 (video && is_video_track_encrypted_)) { |
494 // The media pipeline requires a DecryptConfig with an empty |iv|. | 494 // The media pipeline requires a DecryptConfig with an empty |iv|. |
495 // TODO(ddorwin): Refactor so we do not need a fake key ID ("1"); | 495 // TODO(ddorwin): Refactor so we do not need a fake key ID ("1"); |
496 decrypt_config.reset( | 496 decrypt_config.reset( |
497 new DecryptConfig("1", "", std::vector<SubsampleEntry>())); | 497 new DecryptConfig("1", "", std::vector<SubsampleEntry>())); |
498 } | 498 } |
499 | 499 |
| 500 StreamParserBuffer::Type buffer_type = audio ? DemuxerStream::AUDIO : |
| 501 DemuxerStream::VIDEO; |
| 502 |
| 503 // TODO(wolenetz/acolwell): Validate and use a common cross-parser TrackId |
| 504 // type and allow multiple tracks for same media type, if applicable. See |
| 505 // https://crbug.com/341581. |
500 scoped_refptr<StreamParserBuffer> stream_buf = | 506 scoped_refptr<StreamParserBuffer> stream_buf = |
501 StreamParserBuffer::CopyFrom(&frame_buf[0], frame_buf.size(), | 507 StreamParserBuffer::CopyFrom(&frame_buf[0], frame_buf.size(), |
502 runs_->is_keyframe()); | 508 runs_->is_keyframe(), buffer_type, 0); |
503 | 509 |
504 if (decrypt_config) | 510 if (decrypt_config) |
505 stream_buf->set_decrypt_config(decrypt_config.Pass()); | 511 stream_buf->set_decrypt_config(decrypt_config.Pass()); |
506 | 512 |
507 stream_buf->set_duration(runs_->duration()); | 513 stream_buf->set_duration(runs_->duration()); |
508 stream_buf->set_timestamp(runs_->cts()); | 514 stream_buf->set_timestamp(runs_->cts()); |
509 stream_buf->SetDecodeTimestamp(runs_->dts()); | 515 stream_buf->SetDecodeTimestamp(runs_->dts()); |
510 | 516 |
511 DVLOG(3) << "Pushing frame: aud=" << audio | 517 DVLOG(3) << "Pushing frame: aud=" << audio |
512 << ", key=" << runs_->is_keyframe() | 518 << ", key=" << runs_->is_keyframe() |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 return !err; | 568 return !err; |
563 } | 569 } |
564 | 570 |
565 void MP4StreamParser::ChangeState(State new_state) { | 571 void MP4StreamParser::ChangeState(State new_state) { |
566 DVLOG(2) << "Changing state: " << new_state; | 572 DVLOG(2) << "Changing state: " << new_state; |
567 state_ = new_state; | 573 state_ = new_state; |
568 } | 574 } |
569 | 575 |
570 } // namespace mp4 | 576 } // namespace mp4 |
571 } // namespace media | 577 } // namespace media |
OLD | NEW |