Bug 1073003 - Additional Werror bustage fixes in newly added webrtc code. r=bustage

--HG--
extra : rebase_source : bdf0d3d341a42608366912243c1e1cc9fd398b0c
This commit is contained in:
Botond Ballo 2014-12-22 22:23:51 -05:00
parent 387ccf2fbe
commit ac92460241
4 changed files with 18 additions and 17 deletions

View File

@ -26,7 +26,7 @@ GonkCameraImage::~GonkCameraImage()
} }
nsresult nsresult
GonkCameraImage::GetBuffer(android::MediaBuffer** aBuffer) GonkCameraImage::GetMediaBuffer(android::MediaBuffer** aBuffer)
{ {
ReentrantMonitorAutoEnter mon(mMonitor); ReentrantMonitorAutoEnter mon(mMonitor);
@ -50,7 +50,7 @@ GonkCameraImage::HasMediaBuffer()
} }
nsresult nsresult
GonkCameraImage::SetBuffer(android::MediaBuffer* aBuffer) GonkCameraImage::SetMediaBuffer(android::MediaBuffer* aBuffer)
{ {
ReentrantMonitorAutoEnter mon(mMonitor); ReentrantMonitorAutoEnter mon(mMonitor);
MOZ_ASSERT(!mMediaBuffer); MOZ_ASSERT(!mMediaBuffer);
@ -63,7 +63,7 @@ GonkCameraImage::SetBuffer(android::MediaBuffer* aBuffer)
} }
nsresult nsresult
GonkCameraImage::ClearBuffer() GonkCameraImage::ClearMediaBuffer()
{ {
ReentrantMonitorAutoEnter mon(mMonitor); ReentrantMonitorAutoEnter mon(mMonitor);

View File

@ -24,8 +24,8 @@ namespace mozilla {
* shared memory based on android binder (IMemory), the actual format in IMemory * shared memory based on android binder (IMemory), the actual format in IMemory
* is platform dependent. * is platform dependent.
* This instance is created in MediaEngine when the preview image arrives. * This instance is created in MediaEngine when the preview image arrives.
* The MediaBuffer is attached to the current created GonkCameraImage via SetBuffer(). * The MediaBuffer is attached to the current created GonkCameraImage via SetMediaBuffer().
* After sending this image to MediaStreamGraph by AppendToTrack(), ClearBuffer() * After sending this image to MediaStreamGraph by AppendToTrack(), ClearMediaBuffer()
* must be called to clear MediaBuffer to avoid MediaBuffer be kept in MSG thread. * must be called to clear MediaBuffer to avoid MediaBuffer be kept in MSG thread.
* The reason to keep MediaBuffer be accessed from MSG thread is MediaBuffer is * The reason to keep MediaBuffer be accessed from MSG thread is MediaBuffer is
* limited resource and it could cause frame rate jitter if MediaBuffer stay too * limited resource and it could cause frame rate jitter if MediaBuffer stay too
@ -37,8 +37,8 @@ namespace mozilla {
* Third is the MSG thread via NotifyPull, the image should have preview image * Third is the MSG thread via NotifyPull, the image should have preview image
* only in NotifyPull. * only in NotifyPull.
* *
* Note: SetBuffer() and GetBuffer() should be called from the same thread. It * Note: SetMediaBuffer() and GetMediaBuffer() should be called from the same
* is forbidden to call GetBuffer() from other threads. * thread. It is forbidden to call GetMediaBuffer() from other threads.
*/ */
class GonkCameraImage : public layers::GrallocImage class GonkCameraImage : public layers::GrallocImage
{ {
@ -47,15 +47,15 @@ public:
// The returned aBuffer has called aBuffer->add_ref() already, so it is caller's // The returned aBuffer has called aBuffer->add_ref() already, so it is caller's
// duty to release aBuffer. It should be called from the same thread which // duty to release aBuffer. It should be called from the same thread which
// called SetBuffer(). // called SetMediaBuffer().
nsresult GetBuffer(android::MediaBuffer** aBuffer); nsresult GetMediaBuffer(android::MediaBuffer** aBuffer);
// Set MediaBuffer to image. It is caller's responsibility to call ClearBuffer() // Set MediaBuffer to image. It is caller's responsibility to call ClearMediaBuffer()
// after the MediaBuffer is sent via MediaStreamGraph. // after the MediaBuffer is sent via MediaStreamGraph.
nsresult SetBuffer(android::MediaBuffer* aBuffer); nsresult SetMediaBuffer(android::MediaBuffer* aBuffer);
// It should be called from the same thread which called SetBuffer(). // It should be called from the same thread which called SetMediaBuffer().
nsresult ClearBuffer(); nsresult ClearMediaBuffer();
bool HasMediaBuffer(); bool HasMediaBuffer();
@ -65,7 +65,7 @@ protected:
// mMonitor protects mMediaBuffer and mThread. // mMonitor protects mMediaBuffer and mThread.
ReentrantMonitor mMonitor; ReentrantMonitor mMonitor;
android::MediaBuffer* mMediaBuffer; android::MediaBuffer* mMediaBuffer;
// Check if current thread is the same one which called SetBuffer(). // Check if current thread is the same one which called SetMediaBuffer().
// It doesn't need to hold reference count. // It doesn't need to hold reference count.
DebugOnly<nsIThread*> mThread; DebugOnly<nsIThread*> mThread;
}; };

View File

@ -3,6 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MediaEngineGonkVideoSource.h" #include "MediaEngineGonkVideoSource.h"
#undef LOG_TAG
#define LOG_TAG "MediaEngineGonkVideoSource" #define LOG_TAG "MediaEngineGonkVideoSource"
#include <utils/Log.h> #include <utils/Log.h>
@ -803,7 +804,7 @@ MediaEngineGonkVideoSource::OnNewMediaBufferFrame(MediaBuffer* aBuffer)
// MediaEngineGonkVideoSource expects that GrallocImage is GonkCameraImage. // MediaEngineGonkVideoSource expects that GrallocImage is GonkCameraImage.
// See Bug 938034. // See Bug 938034.
GonkCameraImage* cameraImage = static_cast<GonkCameraImage*>(mImage.get()); GonkCameraImage* cameraImage = static_cast<GonkCameraImage*>(mImage.get());
cameraImage->SetBuffer(aBuffer); cameraImage->SetMediaBuffer(aBuffer);
} else { } else {
LOG(("mImage is non-GrallocImage")); LOG(("mImage is non-GrallocImage"));
} }
@ -824,7 +825,7 @@ MediaEngineGonkVideoSource::OnNewMediaBufferFrame(MediaBuffer* aBuffer)
GonkCameraImage* cameraImage = static_cast<GonkCameraImage*>(mImage.get()); GonkCameraImage* cameraImage = static_cast<GonkCameraImage*>(mImage.get());
// Clear MediaBuffer immediately, it prevents MediaBuffer is kept in // Clear MediaBuffer immediately, it prevents MediaBuffer is kept in
// MediaStreamGraph thread. // MediaStreamGraph thread.
cameraImage->ClearBuffer(); cameraImage->ClearMediaBuffer();
} }
} }

View File

@ -98,7 +98,7 @@ public:
// It adds aBuffer to current preview image and sends this image to MediaStreamDirectListener // It adds aBuffer to current preview image and sends this image to MediaStreamDirectListener
// via AppendToTrack(). Due to MediaBuffer is limited resource, it will clear // via AppendToTrack(). Due to MediaBuffer is limited resource, it will clear
// image's MediaBuffer by calling GonkCameraImage::ClearBuffer() before leaving // image's MediaBuffer by calling GonkCameraImage::ClearMediaBuffer() before leaving
// this function. // this function.
nsresult OnNewMediaBufferFrame(android::MediaBuffer* aBuffer); nsresult OnNewMediaBufferFrame(android::MediaBuffer* aBuffer);