From 0c2130e615be56091603c739eb70baba0dfa00f7 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sun, 29 Dec 2024 13:25:07 +0100 Subject: [PATCH] Issue #2673 - Part 1: Minor ADTSDemuxer cleanup. --- dom/media/ADTSDemuxer.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/dom/media/ADTSDemuxer.cpp b/dom/media/ADTSDemuxer.cpp index cc68a34947..5d32e29cc7 100644 --- a/dom/media/ADTSDemuxer.cpp +++ b/dom/media/ADTSDemuxer.cpp @@ -5,12 +5,10 @@ #include "ADTSDemuxer.h" -#include - -#include "nsAutoPtr.h" -#include "VideoUtils.h" #include "TimeUnits.h" -#include "prenv.h" +#include "VideoUtils.h" +#include "mozilla/UniquePtr.h" +#include #ifdef PR_LOGGING extern mozilla::LazyLogModule gMediaDemuxerLog; @@ -160,11 +158,11 @@ public: } // Returns whether the valid - bool Parse(int64_t aOffset, uint8_t* aStart, uint8_t* aEnd) { + bool Parse(int64_t aOffset, const uint8_t* aStart, const uint8_t* aEnd) { MOZ_ASSERT(aStart && aEnd); bool found = false; - uint8_t* ptr = aStart; + const uint8_t* ptr = aStart; // Require at least 7 bytes of data at the end of the buffer for the minimum // ADTS frame header. while (ptr < aEnd - 7 && !found) { @@ -214,7 +212,7 @@ public: // if one was found. After returning, the variable passed to 'aBytesToSkip' holds // the amount of bytes to be skipped (if any) in order to jump across a large // ID3v2 tag spanning multiple buffers. - bool Parse(int64_t aOffset, uint8_t* aStart, uint8_t* aEnd) { + bool Parse(int64_t aOffset, const uint8_t* aStart, const uint8_t* aEnd) { const bool found = mFrame.Parse(aOffset, aStart, aEnd); if (mFrame.Length() && !mFirstFrame.Length()) { @@ -728,7 +726,7 @@ ADTSTrackDemuxer::GetNextFrame(const adts::Frame& aFrame) RefPtr frame = new MediaRawData(); frame->mOffset = offset; - nsAutoPtr frameWriter(frame->CreateWriter()); + UniquePtr frameWriter(frame->CreateWriter()); if (!frameWriter->SetSize(length)) { ADTSLOG("GetNext() Exit failed to allocated media buffer"); return nullptr;