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

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

Issue 342083002: MSE: Give decode error if MDAT discard peek fails (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months 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 | « no previous file | 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 audio_buffers->clear(); 545 audio_buffers->clear();
546 video_buffers->clear(); 546 video_buffers->clear();
547 return success; 547 return success;
548 } 548 }
549 549
550 bool MP4StreamParser::ReadAndDiscardMDATsUntil(const int64 offset) { 550 bool MP4StreamParser::ReadAndDiscardMDATsUntil(const int64 offset) {
551 bool err = false; 551 bool err = false;
552 while (mdat_tail_ < offset) { 552 while (mdat_tail_ < offset) {
553 const uint8* buf; 553 const uint8* buf;
554 int size; 554 int size;
555 queue_.PeekAt(mdat_tail_, &buf, &size); 555 queue_.PeekAt(mdat_tail_, &buf, &size);
DaleCurtis 2014/06/19 00:58:20 drive-by: the above vars should be zero-initializ
wolenetz 2014/06/19 01:21:31 Good point. Done.
556 if (!buf)
acolwell GONE FROM CHROMIUM 2014/06/19 00:57:03 nit: s/!buf/size == 0/ since all the other PeekAt(
wolenetz 2014/06/19 01:21:31 Done (size <= 0)
557 return false;
556 558
557 FourCC type; 559 FourCC type;
558 int box_sz; 560 int box_sz;
559 if (!BoxReader::StartTopLevelBox(buf, size, log_cb_, 561 if (!BoxReader::StartTopLevelBox(buf, size, log_cb_,
560 &type, &box_sz, &err)) 562 &type, &box_sz, &err))
561 break; 563 break;
562 564
563 if (type != FOURCC_MDAT) { 565 if (type != FOURCC_MDAT) {
564 MEDIA_LOG(log_cb_) << "Unexpected box type while parsing MDATs: " 566 MEDIA_LOG(log_cb_) << "Unexpected box type while parsing MDATs: "
565 << FourCCToString(type); 567 << FourCCToString(type);
566 } 568 }
567 mdat_tail_ += box_sz; 569 mdat_tail_ += box_sz;
568 } 570 }
569 queue_.Trim(std::min(mdat_tail_, offset)); 571 queue_.Trim(std::min(mdat_tail_, offset));
570 return !err; 572 return !err;
571 } 573 }
572 574
573 void MP4StreamParser::ChangeState(State new_state) { 575 void MP4StreamParser::ChangeState(State new_state) {
574 DVLOG(2) << "Changing state: " << new_state; 576 DVLOG(2) << "Changing state: " << new_state;
575 state_ = new_state; 577 state_ = new_state;
576 } 578 }
577 579
578 } // namespace mp4 580 } // namespace mp4
579 } // namespace media 581 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698