Backed out changeset 3d81c5b78567 (bug 1073003)

This commit is contained in:
Carsten "Tomcat" Book 2014-12-23 13:35:04 +01:00
parent 2aabf236cc
commit b71e57324d
4 changed files with 17 additions and 18 deletions

View File

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

View File

@ -24,8 +24,8 @@ namespace mozilla {
* shared memory based on android binder (IMemory), the actual format in IMemory
* is platform dependent.
* This instance is created in MediaEngine when the preview image arrives.
* The MediaBuffer is attached to the current created GonkCameraImage via SetMediaBuffer().
* After sending this image to MediaStreamGraph by AppendToTrack(), ClearMediaBuffer()
* The MediaBuffer is attached to the current created GonkCameraImage via SetBuffer().
* After sending this image to MediaStreamGraph by AppendToTrack(), ClearBuffer()
* 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
* 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
* only in NotifyPull.
*
* Note: SetMediaBuffer() and GetMediaBuffer() should be called from the same
* thread. It is forbidden to call GetMediaBuffer() from other threads.
* Note: SetBuffer() and GetBuffer() should be called from the same thread. It
* is forbidden to call GetBuffer() from other threads.
*/
class GonkCameraImage : public layers::GrallocImage
{
@ -47,15 +47,15 @@ public:
// 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
// called SetMediaBuffer().
nsresult GetMediaBuffer(android::MediaBuffer** aBuffer);
// called SetBuffer().
nsresult GetBuffer(android::MediaBuffer** aBuffer);
// Set MediaBuffer to image. It is caller's responsibility to call ClearMediaBuffer()
// Set MediaBuffer to image. It is caller's responsibility to call ClearBuffer()
// after the MediaBuffer is sent via MediaStreamGraph.
nsresult SetMediaBuffer(android::MediaBuffer* aBuffer);
nsresult SetBuffer(android::MediaBuffer* aBuffer);
// It should be called from the same thread which called SetMediaBuffer().
nsresult ClearMediaBuffer();
// It should be called from the same thread which called SetBuffer().
nsresult ClearBuffer();
bool HasMediaBuffer();
@ -65,7 +65,7 @@ protected:
// mMonitor protects mMediaBuffer and mThread.
ReentrantMonitor mMonitor;
android::MediaBuffer* mMediaBuffer;
// Check if current thread is the same one which called SetMediaBuffer().
// Check if current thread is the same one which called SetBuffer().
// It doesn't need to hold reference count.
DebugOnly<nsIThread*> mThread;
};

View File

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

View File

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