Issue #2673 - Part 1: Minor ADTSDemuxer cleanup.

This commit is contained in:
Moonchild 2024-12-29 13:25:07 +01:00 committed by roytam1
commit 0c2130e615

View file

@ -5,12 +5,10 @@
#include "ADTSDemuxer.h"
#include <inttypes.h>
#include "nsAutoPtr.h"
#include "VideoUtils.h"
#include "TimeUnits.h"
#include "prenv.h"
#include "VideoUtils.h"
#include "mozilla/UniquePtr.h"
#include <inttypes.h>
#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<MediaRawData> frame = new MediaRawData();
frame->mOffset = offset;
nsAutoPtr<MediaRawDataWriter> frameWriter(frame->CreateWriter());
UniquePtr<MediaRawDataWriter> frameWriter(frame->CreateWriter());
if (!frameWriter->SetSize(length)) {
ADTSLOG("GetNext() Exit failed to allocated media buffer");
return nullptr;