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

Side by Side Diff: media/mp4/track_run_iterator.cc

Issue 11471006: Log MediaSource parsing errors to the MediaLog so they can appear in chrome:media-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « media/mp4/track_run_iterator.h ('k') | media/mp4/track_run_iterator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/track_run_iterator.h" 5 #include "media/mp4/track_run_iterator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "media/base/stream_parser_buffer.h" 9 #include "media/base/stream_parser_buffer.h"
10 #include "media/mp4/rcheck.h" 10 #include "media/mp4/rcheck.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 TrackRunInfo::~TrackRunInfo() {} 56 TrackRunInfo::~TrackRunInfo() {}
57 57
58 TimeDelta TimeDeltaFromRational(int64 numer, int64 denom) { 58 TimeDelta TimeDeltaFromRational(int64 numer, int64 denom) {
59 DCHECK_LT((numer > 0 ? numer : -numer), 59 DCHECK_LT((numer > 0 ? numer : -numer),
60 kint64max / base::Time::kMicrosecondsPerSecond); 60 kint64max / base::Time::kMicrosecondsPerSecond);
61 return TimeDelta::FromMicroseconds( 61 return TimeDelta::FromMicroseconds(
62 base::Time::kMicrosecondsPerSecond * numer / denom); 62 base::Time::kMicrosecondsPerSecond * numer / denom);
63 } 63 }
64 64
65 TrackRunIterator::TrackRunIterator(const Movie* moov) 65 TrackRunIterator::TrackRunIterator(const Movie* moov,
66 : moov_(moov), sample_offset_(0) { 66 const LogCB& log_cb)
67 : moov_(moov), log_cb_(log_cb), sample_offset_(0) {
67 CHECK(moov); 68 CHECK(moov);
68 } 69 }
70
69 TrackRunIterator::~TrackRunIterator() {} 71 TrackRunIterator::~TrackRunIterator() {}
70 72
71 static void PopulateSampleInfo(const TrackExtends& trex, 73 static void PopulateSampleInfo(const TrackExtends& trex,
72 const TrackFragmentHeader& tfhd, 74 const TrackFragmentHeader& tfhd,
73 const TrackFragmentRun& trun, 75 const TrackFragmentRun& trun,
74 const int64 edit_list_offset, 76 const int64 edit_list_offset,
75 const uint32 i, 77 const uint32 i,
76 SampleInfo* sample_info) { 78 SampleInfo* sample_info) {
77 if (i < trun.sample_sizes.size()) { 79 if (i < trun.sample_sizes.size()) {
78 sample_info->size = trun.sample_sizes[i]; 80 sample_info->size = trun.sample_sizes[i];
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 425
424 scoped_ptr<DecryptConfig> TrackRunIterator::GetDecryptConfig() { 426 scoped_ptr<DecryptConfig> TrackRunIterator::GetDecryptConfig() {
425 size_t sample_idx = sample_itr_ - run_itr_->samples.begin(); 427 size_t sample_idx = sample_itr_ - run_itr_->samples.begin();
426 DCHECK(sample_idx < cenc_info_.size()); 428 DCHECK(sample_idx < cenc_info_.size());
427 const FrameCENCInfo& cenc_info = cenc_info_[sample_idx]; 429 const FrameCENCInfo& cenc_info = cenc_info_[sample_idx];
428 DCHECK(is_encrypted() && !AuxInfoNeedsToBeCached()); 430 DCHECK(is_encrypted() && !AuxInfoNeedsToBeCached());
429 431
430 if (!cenc_info.subsamples.empty() && 432 if (!cenc_info.subsamples.empty() &&
431 (cenc_info.GetTotalSizeOfSubsamples() != 433 (cenc_info.GetTotalSizeOfSubsamples() !=
432 static_cast<size_t>(sample_size()))) { 434 static_cast<size_t>(sample_size()))) {
433 DVLOG(1) << "Incorrect CENC subsample size."; 435 MEDIA_LOG(log_cb_) << "Incorrect CENC subsample size.";
434 return scoped_ptr<DecryptConfig>(); 436 return scoped_ptr<DecryptConfig>();
435 } 437 }
436 438
437 const std::vector<uint8>& kid = track_encryption().default_kid; 439 const std::vector<uint8>& kid = track_encryption().default_kid;
438 return scoped_ptr<DecryptConfig>(new DecryptConfig( 440 return scoped_ptr<DecryptConfig>(new DecryptConfig(
439 std::string(reinterpret_cast<const char*>(&kid[0]), kid.size()), 441 std::string(reinterpret_cast<const char*>(&kid[0]), kid.size()),
440 std::string(reinterpret_cast<const char*>(cenc_info.iv), 442 std::string(reinterpret_cast<const char*>(cenc_info.iv),
441 arraysize(cenc_info.iv)), 443 arraysize(cenc_info.iv)),
442 0, // No offset to start of media data in MP4 using CENC. 444 0, // No offset to start of media data in MP4 using CENC.
443 cenc_info.subsamples)); 445 cenc_info.subsamples));
444 } 446 }
445 447
446 } // namespace mp4 448 } // namespace mp4
447 } // namespace media 449 } // namespace media
OLDNEW
« no previous file with comments | « media/mp4/track_run_iterator.h ('k') | media/mp4/track_run_iterator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698