Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Side by Side Diff: media/formats/mp4/mp4_stream_parser.cc

Issue 757953002: Add SubsampleEntry constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/cdm/ppapi/external_clear_key/clear_key_cdm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « media/cdm/ppapi/external_clear_key/clear_key_cdm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698