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

Unified Diff: media/formats/mp4/box_reader.cc

Issue 1165313003: Revert of Combine 'pssh' parsing routines. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/formats/mp4/box_reader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp4/box_reader.cc
diff --git a/media/formats/mp4/box_reader.cc b/media/formats/mp4/box_reader.cc
index 4368d8ddc22dfac0825589a824d0795882f450e7..5105726da5d23ba2dddfbbc0469f2bacfd156b73 100644
--- a/media/formats/mp4/box_reader.cc
+++ b/media/formats/mp4/box_reader.cc
@@ -75,17 +75,15 @@
return true;
}
-BoxReader::BoxReader(const uint8* buf,
- const int size,
- const LogCB& log_cb,
- bool is_EOS)
+
+BoxReader::BoxReader(const uint8* buf, const int size,
+ const LogCB& log_cb)
: BufferReader(buf, size),
log_cb_(log_cb),
type_(FOURCC_NULL),
version_(0),
flags_(0),
- scanned_(false),
- is_EOS_(is_EOS) {
+ scanned_(false) {
}
BoxReader::~BoxReader() {
@@ -102,8 +100,7 @@
const int buf_size,
const LogCB& log_cb,
bool* err) {
- scoped_ptr<BoxReader> reader(
- new BoxReader(buf, buf_size, log_cb, false));
+ scoped_ptr<BoxReader> reader(new BoxReader(buf, buf_size, log_cb));
if (!reader->ReadHeader(err))
return NULL;
@@ -125,7 +122,7 @@
FourCC* type,
int* box_size,
bool* err) {
- BoxReader reader(buf, buf_size, log_cb, false);
+ BoxReader reader(buf, buf_size, log_cb);
if (!reader.ReadHeader(err)) return false;
if (!IsValidTopLevelBox(reader.type(), log_cb)) {
*err = true;
@@ -134,12 +131,6 @@
*type = reader.type();
*box_size = reader.size();
return true;
-}
-
-// static
-BoxReader* BoxReader::ReadConcatentatedBoxes(const uint8* buf,
- const int buf_size) {
- return new BoxReader(buf, buf_size, LogCB(), true);
}
// static
@@ -178,7 +169,7 @@
bool err = false;
while (pos() < size()) {
- BoxReader child(&buf_[pos_], size_ - pos_, log_cb_, is_EOS_);
+ BoxReader child(&buf_[pos_], size_ - pos_, log_cb_);
if (!child.ReadHeader(&err)) break;
children_.insert(std::pair<FourCC, BoxReader>(child.type(), child));
@@ -224,30 +215,16 @@
uint64 size = 0;
*err = false;
- if (!HasBytes(8)) {
- // If EOS is known, then this is an error. If not, additional data may be
- // appended later, so this is a soft error.
- *err = is_EOS_;
+ if (!HasBytes(8)) return false;
+ CHECK(Read4Into8(&size) && ReadFourCC(&type_));
+
+ if (size == 0) {
+ MEDIA_LOG(DEBUG, log_cb_) << "Media Source Extensions do not support ISO "
+ "BMFF boxes that run to EOS";
+ *err = true;
return false;
- }
- CHECK(Read4Into8(&size) && ReadFourCC(&type_));
-
- if (size == 0) {
- if (is_EOS_) {
- // All the data bytes are expected to be provided.
- size = size_;
- } else {
- MEDIA_LOG(DEBUG, log_cb_)
- << "ISO BMFF boxes that run to EOS are not supported";
- *err = true;
- return false;
- }
} else if (size == 1) {
- if (!HasBytes(8)) {
- // If EOS is known, then this is an error. If not, it's a soft error.
- *err = is_EOS_;
- return false;
- }
+ if (!HasBytes(8)) return false;
CHECK(Read8(&size));
}
@@ -259,13 +236,6 @@
return false;
}
- // Make sure the buffer contains at least the expected number of bytes.
- // Since the data may be appended in pieces, this can only be checked if EOS.
- if (is_EOS_ && size > static_cast<uint64>(size_)) {
- *err = true;
- return false;
- }
-
// Note that the pos_ head has advanced to the byte immediately after the
// header, which is where we want it.
size_ = size;
« no previous file with comments | « media/formats/mp4/box_reader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698