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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 388 |
389 bool MP4StreamParser::PrepareAACBuffer( | 389 bool MP4StreamParser::PrepareAACBuffer( |
390 const AAC& aac_config, std::vector<uint8>* frame_buf, | 390 const AAC& aac_config, std::vector<uint8>* frame_buf, |
391 std::vector<SubsampleEntry>* subsamples) const { | 391 std::vector<SubsampleEntry>* subsamples) const { |
392 // Append an ADTS header to every audio sample. | 392 // Append an ADTS header to every audio sample. |
393 RCHECK(aac_config.ConvertEsdsToADTS(frame_buf)); | 393 RCHECK(aac_config.ConvertEsdsToADTS(frame_buf)); |
394 | 394 |
395 // As above, adjust subsample information to account for the headers. AAC is | 395 // As above, adjust subsample information to account for the headers. AAC is |
396 // not required to use subsample encryption, so we may need to add an entry. | 396 // not required to use subsample encryption, so we may need to add an entry. |
397 if (subsamples->empty()) { | 397 if (subsamples->empty()) { |
398 SubsampleEntry entry; | 398 subsamples->push_back(SubsampleEntry( |
399 entry.clear_bytes = kADTSHeaderMinSize; | 399 kADTSHeaderMinSize, frame_buf->size() - kADTSHeaderMinSize)); |
400 entry.cypher_bytes = frame_buf->size() - kADTSHeaderMinSize; | |
401 subsamples->push_back(entry); | |
402 } else { | 400 } else { |
403 (*subsamples)[0].clear_bytes += kADTSHeaderMinSize; | 401 (*subsamples)[0].clear_bytes += kADTSHeaderMinSize; |
404 } | 402 } |
405 return true; | 403 return true; |
406 } | 404 } |
407 | 405 |
408 bool MP4StreamParser::EnqueueSample(BufferQueue* audio_buffers, | 406 bool MP4StreamParser::EnqueueSample(BufferQueue* audio_buffers, |
409 BufferQueue* video_buffers, | 407 BufferQueue* video_buffers, |
410 bool* err) { | 408 bool* err) { |
411 DCHECK_EQ(state_, kEmittingSamples); | 409 DCHECK_EQ(state_, kEmittingSamples); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 runs.AdvanceSample(); | 623 runs.AdvanceSample(); |
626 } | 624 } |
627 runs.AdvanceRun(); | 625 runs.AdvanceRun(); |
628 } | 626 } |
629 | 627 |
630 return true; | 628 return true; |
631 } | 629 } |
632 | 630 |
633 } // namespace mp4 | 631 } // namespace mp4 |
634 } // namespace media | 632 } // namespace media |
OLD | NEW |