am 581581fe: Merge "Fix all fd leaks in authoring engine" into gingerbread

Merge commit '581581fe1addfac8913c8d4d6c88eed6ded90de4' into gingerbread-plus-aosp

* commit '581581fe1addfac8913c8d4d6c88eed6ded90de4':
  Fix all fd leaks in authoring engine
This commit is contained in:
James Dong
2010-08-12 09:22:17 -07:00
committed by Android Git Automerger
2 changed files with 7 additions and 5 deletions

View File

@@ -23,6 +23,7 @@
#include <camera/ICamera.h> #include <camera/ICamera.h>
#include <media/IMediaRecorderClient.h> #include <media/IMediaRecorderClient.h>
#include <media/IMediaRecorder.h> #include <media/IMediaRecorder.h>
#include <unistd.h>
namespace android { namespace android {
@@ -373,6 +374,7 @@ status_t BnMediaRecorder::onTransact(
int64_t offset = data.readInt64(); int64_t offset = data.readInt64();
int64_t length = data.readInt64(); int64_t length = data.readInt64();
reply->writeInt32(setOutputFile(fd, offset, length)); reply->writeInt32(setOutputFile(fd, offset, length));
::close(fd);
return NO_ERROR; return NO_ERROR;
} break; } break;
case SET_VIDEO_SIZE: { case SET_VIDEO_SIZE: {

View File

@@ -55,11 +55,6 @@ StagefrightRecorder::StagefrightRecorder()
StagefrightRecorder::~StagefrightRecorder() { StagefrightRecorder::~StagefrightRecorder() {
LOGV("Destructor"); LOGV("Destructor");
stop(); stop();
if (mOutputFd >= 0) {
::close(mOutputFd);
mOutputFd = -1;
}
} }
status_t StagefrightRecorder::init() { status_t StagefrightRecorder::init() {
@@ -1084,6 +1079,11 @@ status_t StagefrightRecorder::stop() {
mFlags = 0; mFlags = 0;
} }
if (mOutputFd >= 0) {
::close(mOutputFd);
mOutputFd = -1;
}
return OK; return OK;
} }