Bug 1073003 - More Werror bustage fixes on a CLOSED TREE. r=bustage

--HG--
extra : rebase_source : 86466eea48ddfc7b5698d97ca574ed6cdf79326e
extra : amend_source : 9eb590b24276a068bbb078152509b3c743bb40f8
This commit is contained in:
Botond Ballo 2014-12-23 00:03:15 -05:00
parent eeea26bbd6
commit 7a523334f9
16 changed files with 74 additions and 85 deletions

View File

@ -34,9 +34,9 @@ IsPukCardLockType(IccLockType aLockType)
case IccLockType::RcckPuk:
case IccLockType::RspckPuk:
return true;
default:
return false;
}
return false;
}
} // anonymous namespace

View File

@ -55,18 +55,18 @@ PRLogModuleInfo* gAudioOffloadPlayerLog;
static const uint64_t OFFLOAD_PAUSE_MAX_MSECS = 60000ll;
AudioOffloadPlayer::AudioOffloadPlayer(MediaOmxCommonDecoder* aObserver) :
mObserver(aObserver),
mInputBuffer(nullptr),
mSampleRate(0),
mSeeking(false),
mSeekDuringPause(false),
mReachedEOS(false),
mSeekTimeUs(0),
mStartPosUs(0),
mPositionTimeMediaUs(-1),
mStarted(false),
mPlaying(false),
mIsElementVisible(true)
mSeeking(false),
mReachedEOS(false),
mSeekDuringPause(false),
mIsElementVisible(true),
mSampleRate(0),
mStartPosUs(0),
mSeekTimeUs(0),
mPositionTimeMediaUs(-1),
mInputBuffer(nullptr),
mObserver(aObserver)
{
MOZ_ASSERT(NS_IsMainThread());

View File

@ -33,11 +33,11 @@ extern PRLogModuleInfo* gAudioOffloadPlayerLog;
using namespace android;
AudioOutput::AudioOutput(int aSessionId, int aUid) :
mCallback(nullptr),
mCallbackCookie(nullptr),
mCallback(nullptr),
mCallbackData(nullptr),
mSessionId(aSessionId),
mUid(aUid)
mUid(aUid),
mSessionId(aSessionId)
{
#ifdef PR_LOGGING
if (!gAudioOffloadPlayerLog) {

View File

@ -26,8 +26,6 @@
#include "AudioSink.h"
#define LOG_TAG "AudioOffloadPlayer"
namespace mozilla {
/**

View File

@ -12,9 +12,8 @@
#include <stagefright/MetaData.h>
#include "stagefright/MediaErrors.h"
#define LOG_TAG "MediaCodecProxy"
#include <android/log.h>
#define ALOG(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#define MCP_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "MediaCodecProxy", __VA_ARGS__)
#define TIMEOUT_DEQUEUE_INPUTBUFFER_MS 1000000ll
namespace android {
@ -183,7 +182,7 @@ MediaCodecProxy::releaseCodec()
// Release MediaCodec
if (mCodec != nullptr) {
status_t err = mCodec->stop();
mCodec->stop();
mCodec->release();
mCodec = nullptr;
}
@ -494,17 +493,16 @@ MediaCodecProxy::resourceCanceled()
bool MediaCodecProxy::Prepare()
{
status_t err;
if (start() != OK) {
ALOG("Couldn't start MediaCodec");
MCP_LOG("Couldn't start MediaCodec");
return false;
}
if (getInputBuffers(&mInputBuffers) != OK) {
ALOG("Couldn't get input buffers from MediaCodec");
MCP_LOG("Couldn't get input buffers from MediaCodec");
return false;
}
if (getOutputBuffers(&mOutputBuffers) != OK) {
ALOG("Couldn't get output buffers from MediaCodec");
MCP_LOG("Couldn't get output buffers from MediaCodec");
return false;
}
@ -514,13 +512,13 @@ bool MediaCodecProxy::Prepare()
bool MediaCodecProxy::UpdateOutputBuffers()
{
if (mCodec == nullptr) {
ALOG("MediaCodec has not been inited from input!");
MCP_LOG("MediaCodec has not been inited from input!");
return false;
}
status_t err = getOutputBuffers(&mOutputBuffers);
if (err != OK){
ALOG("Couldn't update output buffers from MediaCodec");
MCP_LOG("Couldn't update output buffers from MediaCodec");
return false;
}
return true;
@ -530,14 +528,14 @@ status_t MediaCodecProxy::Input(const uint8_t* aData, uint32_t aDataSize,
int64_t aTimestampUsecs, uint64_t aflags)
{
if (mCodec == nullptr) {
ALOG("MediaCodec has not been inited from input!");
MCP_LOG("MediaCodec has not been inited from input!");
return NO_INIT;
}
size_t index;
status_t err = dequeueInputBuffer(&index, TIMEOUT_DEQUEUE_INPUTBUFFER_MS);
if (err != OK) {
ALOG("dequeueInputBuffer returned %d", err);
MCP_LOG("dequeueInputBuffer returned %d", err);
return err;
}
@ -554,7 +552,7 @@ status_t MediaCodecProxy::Input(const uint8_t* aData, uint32_t aDataSize,
}
if (err != OK) {
ALOG("queueInputBuffer returned %d", err);
MCP_LOG("queueInputBuffer returned %d", err);
return err;
}
return err;
@ -563,7 +561,7 @@ status_t MediaCodecProxy::Input(const uint8_t* aData, uint32_t aDataSize,
status_t MediaCodecProxy::Output(MediaBuffer** aBuffer, int64_t aTimeoutUs)
{
if (mCodec == nullptr) {
ALOG("MediaCodec has not been inited from output!");
MCP_LOG("MediaCodec has not been inited from output!");
return NO_INIT;
}

View File

@ -138,15 +138,15 @@ void MediaOmxReader::CancelProcessCachedData()
MediaOmxReader::MediaOmxReader(AbstractMediaDecoder *aDecoder)
: MediaOmxCommonReader(aDecoder)
, mMutex("MediaOmxReader.Data")
, mMP3FrameParser(-1)
, mHasVideo(false)
, mHasAudio(false)
, mVideoSeekTimeUs(-1)
, mAudioSeekTimeUs(-1)
, mLastParserDuration(-1)
, mSkipCount(0)
, mUseParserDuration(false)
, mLastParserDuration(-1)
, mIsShutdown(false)
, mMP3FrameParser(-1)
, mIsWaitingResources(false)
{
#ifdef PR_LOGGING

View File

@ -84,8 +84,8 @@ struct AVCParamSet {
{
// 2 bytes length value.
uint8_t size[] = {
(mSize & 0xFF00) >> 8, // MSB.
mSize & 0x00FF, // LSB.
uint8_t((mSize & 0xFF00) >> 8), // MSB.
uint8_t(mSize & 0x00FF), // LSB.
};
aOutputBuf->AppendElements(size, sizeof(size));
@ -189,7 +189,6 @@ GenerateAVCDescriptorBlob(sp<AMessage>& aConfigData,
return ERROR_MALFORMED;
}
status_t result = OK;
if (aFormat == OMXVideoEncoder::BlobFormat::AVC_NAL) {
// SPS + PPS.
aOutputBuf->AppendElements(sps->data(), sps->size());

View File

@ -55,11 +55,11 @@ OMXCodecProxy::OMXCodecProxy(
const sp<ANativeWindow> &nativeWindow)
: mOMX(omx),
mSrcMeta(meta),
mIsEncoder(createEncoder),
mSource(source),
mComponentName(nullptr),
mIsEncoder(createEncoder),
mFlags(flags),
mNativeWindow(nativeWindow),
mSource(source),
mState(MediaResourceManagerClient::CLIENT_STATE_WAIT_FOR_RESOURCE)
{
}

View File

@ -287,11 +287,11 @@ ConvertPlanarYCbCrToNV12(const PlanarYCbCrData* aSource, uint8_t* aDestination)
size_t vPixStride = horiSubsample * (1 + aSource->mCrSkip);
size_t lineStride = uvSize.height / uvHeight * aSource->mCbCrStride;
for (int i = 0; i < uvHeight; i++) {
for (size_t i = 0; i < uvHeight; i++) {
// 1st pixel per line.
uint8_t* uSrc = u;
uint8_t* vSrc = v;
for (int j = 0; j < uvWidth; j++) {
for (size_t j = 0; j < uvWidth; j++) {
*aDestination++ = *uSrc;
*aDestination++ = *vSrc;
// Pick next source pixel.
@ -495,10 +495,10 @@ OMXVideoEncoder::AppendFrame(nsTArray<uint8_t>* aOutputBuf,
}
// Replace start code with data length.
uint8_t length[] = {
(aSize >> 24) & 0xFF,
(aSize >> 16) & 0xFF,
(aSize >> 8) & 0xFF,
aSize & 0xFF,
uint8_t((aSize >> 24) & 0xFF),
uint8_t((aSize >> 16) & 0xFF),
uint8_t((aSize >> 8) & 0xFF),
uint8_t(aSize & 0xFF),
};
aOutputBuf->AppendElements(length, sizeof(length));
aOutputBuf->AppendElements(aData + sizeof(length), aSize);
@ -592,8 +592,8 @@ public:
, mInputFlags(aInputFlags)
, mIndex(0)
, mData(nullptr)
, mOffset(0)
, mCapicity(0)
, mOffset(0)
{}
~InputBufferHelper()
@ -908,14 +908,14 @@ OMXAudioEncoder::AppendDecoderConfig(nsTArray<uint8_t>* aOutputBuf,
// Decoder config descriptor
const uint8_t decConfig[] = {
0x04, // Decoder config descriptor tag.
15 + csdSize, // Size: following bytes + csd size.
uint8_t(15 + csdSize), // Size: following bytes + csd size.
0x40, // Object type: MPEG-4 audio.
0x15, // Stream type: audio, reserved: 1.
0x00, 0x03, 0x00, // Buffer size: 768 (kAACFrameSize).
0x00, 0x01, 0x77, 0x00, // Max bitrate: 96000 (kAACBitrate).
0x00, 0x01, 0x77, 0x00, // Avg bitrate: 96000 (kAACBitrate).
0x05, // Decoder specific descriptor tag.
csdSize, // Data size.
uint8_t(csdSize), // Data size.
};
// SL config descriptor.
const uint8_t slConfig[] = {

View File

@ -33,9 +33,8 @@
#include "OMXCodecProxy.h"
#include "OmxDecoder.h"
#define LOG_TAG "OmxDecoder"
#include <android/log.h>
#define ALOG(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#define OD_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "OmxDecoder", __VA_ARGS__)
#ifdef PR_LOGGING
PRLogModuleInfo *gOmxDecoderLog;
@ -65,13 +64,13 @@ OmxDecoder::OmxDecoder(MediaResource *aResource,
mAudioChannels(-1),
mAudioSampleRate(-1),
mDurationUs(-1),
mVideoLastFrameTime(-1),
mVideoBuffer(nullptr),
mAudioBuffer(nullptr),
mIsVideoSeeking(false),
mAudioMetadataRead(false),
mAudioPaused(false),
mVideoPaused(false),
mVideoLastFrameTime(-1)
mVideoPaused(false)
{
mLooper = new ALooper;
mLooper->setName("OmxDecoder");
@ -119,7 +118,6 @@ bool OmxDecoder::Init(sp<MediaExtractor>& extractor) {
}
#endif
const char* extractorMime;
sp<MetaData> meta = extractor->getMetaData();
ssize_t audioTrackIndex = -1;
@ -177,7 +175,6 @@ bool OmxDecoder::EnsureMetadata() {
}
if (mAudioTrack.get()) {
durationUs = -1;
const char* audioMime;
sp<MetaData> meta = mAudioTrack->getFormat();
if ((durationUs == -1) && meta->findInt64(kKeyDuration, &durationUs)) {
@ -604,7 +601,7 @@ bool OmxDecoder::ReadVideo(VideoFrame *aFrame, int64_t aTimeUs,
}
continue;
} else if (err != OK) {
ALOG("Unexpected error when seeking to %lld", aTimeUs);
OD_LOG("Unexpected error when seeking to %lld", aTimeUs);
break;
}
// For some codecs, the length of first decoded frame after seek is 0.

View File

@ -148,7 +148,7 @@ void MediaResourceManagerService::onMessageReceived(const sp<AMessage> &msg)
return;
}
const sp<IBinder>& req = mResources.nextRequest(type);
sp<IBinder> req = mResources.nextRequest(type);
mResources.aquireResource(req, type, found);
// Notify resource assignment to the client.
sp<IMediaResourceManagerClient> client = interface_cast<IMediaResourceManagerClient>(req);
@ -292,7 +292,7 @@ uint32_t MediaResourceManagerService::ResourceTable::countRequests(ResourceType
return queue.size();
}
const sp<IBinder>& MediaResourceManagerService::ResourceTable::nextRequest(ResourceType type)
sp<IBinder> MediaResourceManagerService::ResourceTable::nextRequest(ResourceType type)
{
ssize_t found = mMap.indexOfKey(type);
if (found == NAME_NOT_FOUND) {
@ -333,7 +333,7 @@ status_t MediaResourceManagerService::ResourceTable::dequeueRequest(ResourceType
status_t MediaResourceManagerService::ResourceTable::forgetClient(const sp<IBinder>& client)
{
// Traverse all resources.
for (int i = 0; i < mMap.size(); i++) {
for (size_t i = 0; i < mMap.size(); i++) {
forgetClient(client, mMap.keyAt(i));
}
return OK;
@ -358,7 +358,7 @@ status_t MediaResourceManagerService::ResourceTable::forgetClient(const sp<IBind
// Revoke ownership for given client.
Slots& slots = resources.mSlots;
for (int i = 0; i < slots.size(); i++) {
for (size_t i = 0; i < slots.size(); i++) {
ResourceSlot& slot = slots.editItemAt(i);
if (client.get() == slot.mClient.get()) {
slot.mClient = nullptr;

View File

@ -99,7 +99,7 @@ private:
// Request operations.
bool hasRequest(ResourceType type);
uint32_t countRequests(ResourceType type);
const sp<IBinder>& nextRequest(ResourceType type);
sp<IBinder> nextRequest(ResourceType type);
status_t enqueueRequest(const sp<IBinder>& client, ResourceType type);
status_t dequeueRequest(ResourceType type);
status_t forgetClient(const sp<IBinder>& client, ResourceType type);

View File

@ -24,6 +24,14 @@ SOURCES += [
include('/ipc/chromium/chromium-config.mozbuild')
# Suppress some GCC/clang warnings being treated as errors:
# - about multi-character constants which are used in codec-related code
if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
CXXFLAGS += [
'-Wno-error=multichar'
]
FINAL_LIBRARY = 'xul'
CXXFLAGS += [
'-I%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [
'frameworks/base/include',

View File

@ -79,6 +79,16 @@ if CONFIG['ANDROID_VERSION'] >= '18':
include('/ipc/chromium/chromium-config.mozbuild')
# Suppress some GCC/clang warnings being treated as errors:
# - about attributes on forward declarations for types that are already
# defined, which complains about an important MOZ_EXPORT for android::AString
# - about multi-character constants which are used in codec-related code
if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
CXXFLAGS += [
'-Wno-error=attributes',
'-Wno-error=multichar'
]
FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
'/dom/base',

View File

@ -231,7 +231,7 @@ TemporaryRef<gfx::DataSourceSurface>
GrallocTextureHostOGL::GetAsSurface() {
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
uint8_t* grallocData;
int32_t rv = graphicBuffer->lock(GRALLOC_USAGE_SW_READ_OFTEN, reinterpret_cast<void**>(&grallocData));
graphicBuffer->lock(GRALLOC_USAGE_SW_READ_OFTEN, reinterpret_cast<void**>(&grallocData));
RefPtr<gfx::DataSourceSurface> grallocTempSurf =
gfx::Factory::CreateWrappingDataSourceSurface(grallocData,
graphicBuffer->getStride() * android::bytesPerPixel(graphicBuffer->getPixelFormat()),

View File

@ -330,32 +330,6 @@ GetThreadInfo(pthread_t threadID) {
return tinfo;
}
/**
* Get thread info using the specified native thread ID.
*
* @return thread_info_t with nativeThreadID == specified threadID
*/
static thread_info_t*
GetThreadInfo(pid_t threadID) {
if (sIsNuwaProcess) {
REAL(pthread_mutex_lock)(&sThreadCountLock);
}
thread_info_t *thrinfo = nullptr;
for (thread_info_t *tinfo = sAllThreads.getFirst();
tinfo;
tinfo = tinfo->getNext()) {
if (tinfo->origNativeThreadID == threadID) {
thrinfo = tinfo;
break;
}
}
if (sIsNuwaProcess) {
pthread_mutex_unlock(&sThreadCountLock);
}
return thrinfo;
}
#if !defined(HAVE_THREAD_TLS_KEYWORD)
/**
* Get thread info of the current thread.
@ -909,11 +883,16 @@ static int sRecreateGatePassed = 0;
* 3) Freeze point 2: blocks the current thread by acquiring sThreadFreezeLock.
* If freezing is not enabled then revert the counter change in freeze
* point 1.
*
* Note: the purpose of the '(void) variable;' statements is to avoid
* -Wunused-but-set-variable warnings.
*/
#define THREAD_FREEZE_POINT1() \
bool freezeCountChg = false; \
bool recreated = false; \
(void) recreated; \
volatile bool freezePoint2 = false; \
(void) freezePoint2; \
thread_info_t *tinfo; \
if (sIsNuwaProcess && \
(tinfo = CUR_THREAD_INFO) && \