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 ? |
| 501 StreamParserBuffer::kAudio : StreamParserBuffer::kVideo; |
500 scoped_refptr<StreamParserBuffer> stream_buf = | 502 scoped_refptr<StreamParserBuffer> stream_buf = |
501 StreamParserBuffer::CopyFrom(&frame_buf[0], frame_buf.size(), | 503 StreamParserBuffer::CopyFrom(&frame_buf[0], frame_buf.size(), |
502 runs_->is_keyframe()); | 504 runs_->is_keyframe(), buffer_type); |
503 | 505 |
504 if (decrypt_config) | 506 if (decrypt_config) |
505 stream_buf->set_decrypt_config(decrypt_config.Pass()); | 507 stream_buf->set_decrypt_config(decrypt_config.Pass()); |
506 | 508 |
507 stream_buf->set_duration(runs_->duration()); | 509 stream_buf->set_duration(runs_->duration()); |
508 stream_buf->set_timestamp(runs_->cts()); | 510 stream_buf->set_timestamp(runs_->cts()); |
509 stream_buf->SetDecodeTimestamp(runs_->dts()); | 511 stream_buf->SetDecodeTimestamp(runs_->dts()); |
510 | 512 |
511 DVLOG(3) << "Pushing frame: aud=" << audio | 513 DVLOG(3) << "Pushing frame: aud=" << audio |
512 << ", key=" << runs_->is_keyframe() | 514 << ", key=" << runs_->is_keyframe() |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 return !err; | 564 return !err; |
563 } | 565 } |
564 | 566 |
565 void MP4StreamParser::ChangeState(State new_state) { | 567 void MP4StreamParser::ChangeState(State new_state) { |
566 DVLOG(2) << "Changing state: " << new_state; | 568 DVLOG(2) << "Changing state: " << new_state; |
567 state_ = new_state; | 569 state_ = new_state; |
568 } | 570 } |
569 | 571 |
570 } // namespace mp4 | 572 } // namespace mp4 |
571 } // namespace media | 573 } // namespace media |
OLD | NEW |