Bug 862182 - Hold references to MediaResource in nsRefPtrs (content/media/omx), and fix some omx compiler warnings. r=doublec

This commit is contained in:
Chris Pearce 2013-05-01 11:23:46 +12:00
parent 679b4dd00f
commit 252138b2cf
4 changed files with 14 additions and 18 deletions

View File

@ -22,7 +22,6 @@ struct VideoPlane {
struct VideoFrame {
int64_t mTimeUs;
int64_t mEndTimeUs;
bool mKeyFrame;
bool mShouldSkip;
void *mData;

View File

@ -43,7 +43,7 @@ nsresult MediaOmxReader::Init(MediaDecoderReader* aCloneDonor)
}
nsresult MediaOmxReader::ReadMetadata(VideoInfo* aInfo,
MetadataTags** aTags)
MetadataTags** aTags)
{
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
@ -118,7 +118,7 @@ nsresult MediaOmxReader::ResetDecode()
}
bool MediaOmxReader::DecodeVideoFrame(bool &aKeyframeSkip,
int64_t aTimeThreshold)
int64_t aTimeThreshold)
{
// Record number of frames decoded and parsed. Automatically update the
// stats counters using the AutoNotifyDecoded stack-based class.
@ -339,7 +339,7 @@ void MediaOmxReader::OnDecodeThreadFinish() {
void MediaOmxReader::OnDecodeThreadStart() {
if (mOmxDecoder.get()) {
nsresult result = mOmxDecoder->Play();
DebugOnly<nsresult> result = mOmxDecoder->Play();
NS_ASSERTION(result == NS_OK, "OmxDecoder should be in play state to continue decoding");
}
}

View File

@ -39,8 +39,8 @@ VideoGraphicBuffer::VideoGraphicBuffer(const android::wp<android::OmxDecoder> aO
android::MediaBuffer *aBuffer,
SurfaceDescriptor *aDescriptor)
: GraphicBufferLocked(*aDescriptor),
mOmxDecoder(aOmxDecoder),
mMediaBuffer(aBuffer)
mMediaBuffer(aBuffer),
mOmxDecoder(aOmxDecoder)
{
mMediaBuffer->add_ref();
}
@ -74,7 +74,7 @@ namespace android {
MediaStreamSource::MediaStreamSource(MediaResource *aResource,
AbstractMediaDecoder *aDecoder) :
mDecoder(aDecoder), mResource(aResource)
mResource(aResource), mDecoder(aDecoder)
{
}
@ -127,8 +127,8 @@ using namespace android;
OmxDecoder::OmxDecoder(MediaResource *aResource,
AbstractMediaDecoder *aDecoder) :
mResource(aResource),
mDecoder(aDecoder),
mResource(aResource),
mVideoWidth(0),
mVideoHeight(0),
mVideoColorFormat(0),
@ -141,8 +141,8 @@ OmxDecoder::OmxDecoder(MediaResource *aResource,
mVideoBuffer(nullptr),
mAudioBuffer(nullptr),
mIsVideoSeeking(false),
mPaused(false),
mAudioMetadataRead(false)
mAudioMetadataRead(false),
mPaused(false)
{
}
@ -234,7 +234,7 @@ bool OmxDecoder::Init() {
// OMXClient::connect() always returns OK and abort's fatally if
// it can't connect.
OMXClient client;
status_t err = client.connect();
DebugOnly<status_t> err = client.connect();
NS_ASSERTION(err == OK, "Failed to connect to OMX in mediaserver.");
sp<IOMX> omx = client.interface();
@ -512,7 +512,6 @@ bool OmxDecoder::ReadVideo(VideoFrame *aFrame, int64_t aTimeUs,
if (err == OK && mVideoBuffer->range_length() > 0) {
int64_t timeUs;
int64_t durationUs;
int32_t unreadable;
int32_t keyFrame;
@ -545,7 +544,6 @@ bool OmxDecoder::ReadVideo(VideoFrame *aFrame, int64_t aTimeUs,
aFrame->mGraphicBuffer = new mozilla::layers::VideoGraphicBuffer(this, mVideoBuffer, &newDescriptor);
aFrame->mRotation = mVideoRotation;
aFrame->mTimeUs = timeUs;
aFrame->mEndTimeUs = timeUs + durationUs;
aFrame->mKeyFrame = keyFrame;
aFrame->Y.mWidth = mVideoWidth;
aFrame->Y.mHeight = mVideoHeight;
@ -560,8 +558,6 @@ bool OmxDecoder::ReadVideo(VideoFrame *aFrame, int64_t aTimeUs,
if (!ToVideoFrame(aFrame, timeUs, data, length, keyFrame)) {
return false;
}
aFrame->mEndTimeUs = timeUs + durationUs;
}
if (aKeyframeSkip && timeUs < aTimeUs) {
@ -696,3 +692,4 @@ void OmxDecoder::Pause() {
}
mPaused = true;
}

View File

@ -38,10 +38,10 @@ class MediaStreamSource : public DataSource {
typedef mozilla::MediaResource MediaResource;
typedef mozilla::AbstractMediaDecoder AbstractMediaDecoder;
MediaResource *mResource;
nsRefPtr<MediaResource> mResource;
AbstractMediaDecoder *mDecoder;
public:
MediaStreamSource(MediaResource *aResource,
MediaStreamSource(MediaResource* aResource,
AbstractMediaDecoder *aDecoder);
virtual status_t initCheck() const;
@ -80,7 +80,7 @@ class OmxDecoder : public RefBase {
};
AbstractMediaDecoder *mDecoder;
MediaResource *mResource;
nsRefPtr<MediaResource> mResource;
sp<GonkNativeWindow> mNativeWindow;
sp<GonkNativeWindowClient> mNativeWindowClient;
sp<MediaSource> mVideoTrack;