Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1388288 - Make Flac and Ogg decoders build in non-Unified mode. r…
Browse files Browse the repository at this point in the history
…=jya

FLAC_MAX_CHANNELS is used in FlacDemuxer and in FrameParser, so move it,
and all the other FLAC_{MIN,MAX}* #defines to FrameParser.h. The other
defines don't technically need to be there, but it's nicer to have them
all defined together.

MozReview-Commit-ID: LVZzXvBSvMq
  • Loading branch information
Chris Pearce committed Aug 8, 2017
1 parent 76c43e5 commit b83b701
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
8 changes: 0 additions & 8 deletions dom/media/flac/FlacDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ namespace flac {
// flac::FrameHeader - Holds the flac frame header and its parsing
// state.

#define FLAC_MAX_CHANNELS 8
#define FLAC_MIN_BLOCKSIZE 16
#define FLAC_MAX_BLOCKSIZE 65535
#define FLAC_MIN_FRAME_SIZE 11
#define FLAC_MAX_FRAME_HEADER_SIZE 16
#define FLAC_MAX_FRAME_SIZE (FLAC_MAX_FRAME_HEADER_SIZE \
+FLAC_MAX_BLOCKSIZE*FLAC_MAX_CHANNELS*3)

class FrameHeader
{
public:
Expand Down
8 changes: 8 additions & 0 deletions dom/media/flac/FlacFrameParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
namespace mozilla
{

#define FLAC_MAX_CHANNELS 8
#define FLAC_MIN_BLOCKSIZE 16
#define FLAC_MAX_BLOCKSIZE 65535
#define FLAC_MIN_FRAME_SIZE 11
#define FLAC_MAX_FRAME_HEADER_SIZE 16
#define FLAC_MAX_FRAME_SIZE (FLAC_MAX_FRAME_HEADER_SIZE \
+FLAC_MAX_BLOCKSIZE*FLAC_MAX_CHANNELS*3)

class OpusParser;

// Decode a Flac Metadata block contained in either a ogg packet
Expand Down
14 changes: 6 additions & 8 deletions dom/media/ogg/OggDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,8 +675,7 @@ OggDemuxer::ReadOggChain(const media::TimeUnit& aLastEndTime)
newVorbisState->GetInfo()->GetAsAudioInfo()->mChannels)) {

SetupTarget(&mVorbisState, newVorbisState);
LOG(LogLevel::Debug,
("New vorbis ogg link, serial=%d\n", mVorbisState->mSerial));
OGG_DEBUG("New vorbis ogg link, serial=%d\n", mVorbisState->mSerial);

if (msgInfo) {
InitTrack(msgInfo, &mInfo.mAudio, true);
Expand Down Expand Up @@ -711,8 +710,7 @@ OggDemuxer::ReadOggChain(const media::TimeUnit& aLastEndTime)
newFlacState->GetInfo()->GetAsAudioInfo()->mChannels)) {

SetupTarget(&mFlacState, newFlacState);
LOG(LogLevel::Debug,
("New flac ogg link, serial=%d\n", mFlacState->mSerial));
OGG_DEBUG("New flac ogg link, serial=%d\n", mFlacState->mSerial);

if (msgInfo) {
InitTrack(msgInfo, &mInfo.mAudio, true);
Expand Down Expand Up @@ -1178,8 +1176,8 @@ OggDemuxer::SeekToKeyframeUsingIndex(TrackInfo::TrackType aType, int64_t aTarget
// Index must be invalid.
return RollbackIndexedSeek(aType, tell);
}
LOG(LogLevel::Debug, ("Seeking using index to keyframe at offset %" PRId64 "\n",
keyframe.mKeyPoint.mOffset));
OGG_DEBUG("Seeking using index to keyframe at offset %" PRId64 "\n",
keyframe.mKeyPoint.mOffset);
nsresult res = Resource(aType)->Seek(nsISeekableStream::NS_SEEK_SET,
keyframe.mKeyPoint.mOffset);
NS_ENSURE_SUCCESS(res, SEEK_FATAL_ERROR);
Expand All @@ -1201,8 +1199,8 @@ OggDemuxer::SeekToKeyframeUsingIndex(TrackInfo::TrackType aType, int64_t aTarget
skippedBytes);
NS_ENSURE_TRUE(syncres != PAGE_SYNC_ERROR, SEEK_FATAL_ERROR);
if (syncres != PAGE_SYNC_OK || skippedBytes != 0) {
LOG(LogLevel::Debug, ("Indexed-seek failure: Ogg Skeleton Index is invalid "
"or sync error after seek"));
OGG_DEBUG("Indexed-seek failure: Ogg Skeleton Index is invalid "
"or sync error after seek");
return RollbackIndexedSeek(aType, tell);
}
uint32_t serial = ogg_page_serialno(&page);
Expand Down

0 comments on commit b83b701

Please sign in to comment.