From ce64f058d5d048fbe206471660c8a5be5a95d93c Mon Sep 17 00:00:00 2001 From: Edwin Flores Date: Fri, 21 Mar 2014 19:35:14 +1300 Subject: [PATCH] Bug 941298 - Fix errors in content/media/fmp4 on Linux with clang and --enable-warnings-as-errors r=cpearce --- content/media/fmp4/BlankDecoderModule.cpp | 10 ++++------ content/media/fmp4/MP4Reader.cpp | 6 ++++-- content/media/fmp4/demuxer/basictypes.h | 4 ++-- content/media/fmp4/demuxer/box_reader.h | 2 +- content/media/fmp4/demuxer/mp4_demuxer.cc | 10 ---------- 5 files changed, 11 insertions(+), 21 deletions(-) diff --git a/content/media/fmp4/BlankDecoderModule.cpp b/content/media/fmp4/BlankDecoderModule.cpp index f763bf949bf..3cec5bf5da3 100644 --- a/content/media/fmp4/BlankDecoderModule.cpp +++ b/content/media/fmp4/BlankDecoderModule.cpp @@ -45,8 +45,8 @@ public: MediaDataDecoderCallback* aCallback, BlankMediaDataCreator* aCreator) : mSample(aSample) - , mCallback(aCallback) , mCreator(aCreator) + , mCallback(aCallback) { } NS_IMETHOD Run() MOZ_OVERRIDE @@ -161,10 +161,9 @@ public: BlankAudioDataCreator(uint32_t aChannelCount, uint32_t aSampleRate, uint16_t aBitsPerSample) - : mFrameSum(0), - mChannelCount(aChannelCount), - mSampleRate(aSampleRate), - mBitsPerSample(aBitsPerSample) + : mFrameSum(0) + , mChannelCount(aChannelCount) + , mSampleRate(aSampleRate) { } @@ -204,7 +203,6 @@ private: int64_t mFrameSum; uint32_t mChannelCount; uint32_t mSampleRate; - uint16_t mBitsPerSample; }; class BlankDecoderModule : public PlatformDecoderModule { diff --git a/content/media/fmp4/MP4Reader.cpp b/content/media/fmp4/MP4Reader.cpp index ea1d36b81f9..ab8ccc0d688 100644 --- a/content/media/fmp4/MP4Reader.cpp +++ b/content/media/fmp4/MP4Reader.cpp @@ -49,7 +49,7 @@ public: MOZ_COUNT_CTOR(MP4Stream); MOZ_ASSERT(aResource); } - ~MP4Stream() { + virtual ~MP4Stream() { MOZ_COUNT_DTOR(MP4Stream); } @@ -83,10 +83,10 @@ private: MP4Reader::MP4Reader(AbstractMediaDecoder* aDecoder) : MediaDecoderReader(aDecoder) - , mLayersBackendType(layers::LayersBackend::LAYERS_NONE) , mAudio("MP4 audio decoder data", Preferences::GetUint("media.mp4-audio-decode-ahead", 2)) , mVideo("MP4 video decoder data", Preferences::GetUint("media.mp4-video-decode-ahead", 2)) , mLastReportedNumDecodedFrames(0) + , mLayersBackendType(layers::LayersBackend::LAYERS_NONE) { MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread."); MOZ_COUNT_CTOR(MP4Reader); @@ -371,6 +371,7 @@ MP4Reader::Decode(TrackType aTrack) return true; } +#ifdef LOG_SAMPLE_DECODE static const char* TrackTypeToStr(TrackType aTrack) { @@ -381,6 +382,7 @@ TrackTypeToStr(TrackType aTrack) default: return "Unknown"; } } +#endif void MP4Reader::Output(mp4_demuxer::TrackType aTrack, MediaData* aSample) diff --git a/content/media/fmp4/demuxer/basictypes.h b/content/media/fmp4/demuxer/basictypes.h index 20be78ee194..7d876f4ea9c 100644 --- a/content/media/fmp4/demuxer/basictypes.h +++ b/content/media/fmp4/demuxer/basictypes.h @@ -61,12 +61,12 @@ namespace mp4_demuxer { #ifdef PR_LOGGING #define DMX_LOG(...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__)) #else -#define DMX_LOG(...) 0 +#define DMX_LOG(...) (void)0 #endif #else // define DMX_LOG as 0, so that if(condition){DMX_LOG(...)} branches don't elicit // a warning-as-error. -#define DMX_LOG(...) 0 +#define DMX_LOG(...) (void)0 #endif // A macro to disallow the evil copy constructor and operator= functions diff --git a/content/media/fmp4/demuxer/box_reader.h b/content/media/fmp4/demuxer/box_reader.h index 9c891328092..5cf6e84ec1a 100644 --- a/content/media/fmp4/demuxer/box_reader.h +++ b/content/media/fmp4/demuxer/box_reader.h @@ -27,7 +27,7 @@ struct Box { class StreamReader { public: StreamReader(Stream* stream, int64_t offset, int64_t size) - : stream_(stream), start_(offset), pos_(0), size_(size) {} + : start_(offset), size_(size), pos_(0), stream_(stream) {} bool HasBytes(int count) { return (pos() + count <= size()); } diff --git a/content/media/fmp4/demuxer/mp4_demuxer.cc b/content/media/fmp4/demuxer/mp4_demuxer.cc index b1994644b07..9200faaa81d 100644 --- a/content/media/fmp4/demuxer/mp4_demuxer.cc +++ b/content/media/fmp4/demuxer/mp4_demuxer.cc @@ -97,8 +97,6 @@ bool MP4Demuxer::Init() void MP4Demuxer::Reset() { moov_ = nullptr; runs_ = nullptr; - stream_offset_; // TODO; Not sure if this needs to be reset? - DMX_LOG("Warning: resetting stream_offset_\n"); moof_head_ = 0; mdat_tail_ = 0; } @@ -303,15 +301,7 @@ bool MP4Demuxer::ParseBox() { } bool MP4Demuxer::EmitSample(nsAutoPtr* sample) { - bool ok = true; if (!runs_->IsRunValid()) { - - // Flush any buffers we've gotten in this chunk so that buffers don't - // cross NewSegment() calls - //ok = SendAndFlushSamples(/*audio_buffers, video_buffers*/); - //if (!ok) - // return false; - ChangeState(kParsingBoxes); //end_of_segment_cb_.Run(); return true;