| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mp4/mp4_stream_parser.h" | 5 #include "media/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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 return false; | 486 return false; |
| 487 } | 487 } |
| 488 } | 488 } |
| 489 | 489 |
| 490 if (decrypt_config) { | 490 if (decrypt_config) { |
| 491 if (!subsamples.empty()) { | 491 if (!subsamples.empty()) { |
| 492 // Create a new config with the updated subsamples. | 492 // Create a new config with the updated subsamples. |
| 493 decrypt_config.reset(new DecryptConfig( | 493 decrypt_config.reset(new DecryptConfig( |
| 494 decrypt_config->key_id(), | 494 decrypt_config->key_id(), |
| 495 decrypt_config->iv(), | 495 decrypt_config->iv(), |
| 496 decrypt_config->data_offset(), | |
| 497 subsamples)); | 496 subsamples)); |
| 498 } | 497 } |
| 499 // else, use the existing config. | 498 // else, use the existing config. |
| 500 } else if ((audio && is_audio_track_encrypted_) || | 499 } else if ((audio && is_audio_track_encrypted_) || |
| 501 (video && is_video_track_encrypted_)) { | 500 (video && is_video_track_encrypted_)) { |
| 502 // The media pipeline requires a DecryptConfig with an empty |iv|. | 501 // The media pipeline requires a DecryptConfig with an empty |iv|. |
| 503 // TODO(ddorwin): Refactor so we do not need a fake key ID ("1"); | 502 // TODO(ddorwin): Refactor so we do not need a fake key ID ("1"); |
| 504 decrypt_config.reset( | 503 decrypt_config.reset( |
| 505 new DecryptConfig("1", "", 0, std::vector<SubsampleEntry>())); | 504 new DecryptConfig("1", "", std::vector<SubsampleEntry>())); |
| 506 } | 505 } |
| 507 | 506 |
| 508 scoped_refptr<StreamParserBuffer> stream_buf = | 507 scoped_refptr<StreamParserBuffer> stream_buf = |
| 509 StreamParserBuffer::CopyFrom(&frame_buf[0], frame_buf.size(), | 508 StreamParserBuffer::CopyFrom(&frame_buf[0], frame_buf.size(), |
| 510 runs_->is_keyframe()); | 509 runs_->is_keyframe()); |
| 511 | 510 |
| 512 if (decrypt_config) | 511 if (decrypt_config) |
| 513 stream_buf->set_decrypt_config(decrypt_config.Pass()); | 512 stream_buf->set_decrypt_config(decrypt_config.Pass()); |
| 514 | 513 |
| 515 stream_buf->set_duration(runs_->duration()); | 514 stream_buf->set_duration(runs_->duration()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 return !err; | 566 return !err; |
| 568 } | 567 } |
| 569 | 568 |
| 570 void MP4StreamParser::ChangeState(State new_state) { | 569 void MP4StreamParser::ChangeState(State new_state) { |
| 571 DVLOG(2) << "Changing state: " << new_state; | 570 DVLOG(2) << "Changing state: " << new_state; |
| 572 state_ = new_state; | 571 state_ = new_state; |
| 573 } | 572 } |
| 574 | 573 |
| 575 } // namespace mp4 | 574 } // namespace mp4 |
| 576 } // namespace media | 575 } // namespace media |
| OLD | NEW |