Bug 804741 - Close our recorder output file handle because recorder dup()s it. r=mwu, a=blocking-basecamp

This commit is contained in:
Mike Habicher 2012-10-29 16:16:42 -07:00
Родитель 9c6ada9fc9
Коммит 374e3de73e
1 изменённых файлов: 5 добавлений и 7 удалений

Просмотреть файл

@ -28,6 +28,7 @@
#include "jsapi.h"
#include "nsThread.h"
#include <media/MediaProfiles.h>
#include "mozilla/FileUtils.h"
#include "nsDirectoryServiceDefs.h" // for NS_GetSpecialDirectory
#include "nsPrintfCString.h"
#include "DOMCameraManager.h"
@ -734,20 +735,17 @@ nsGonkCameraControl::StartRecordingImpl(StartRecordingTask* aStartRecording)
filename->GetNativePath(nativeFilename);
DOM_CAMERA_LOGI("Video filename is '%s'\n", nativeFilename.get());
int fd = open(nativeFilename.get(), O_RDWR | O_CREAT, 0644);
ScopedClose fd(open(nativeFilename.get(), O_RDWR | O_CREAT, 0644));
if (fd < 0) {
DOM_CAMERA_LOGE("Couldn't create file '%s': (%d) %s\n", nativeFilename.get(), errno, strerror(errno));
return NS_ERROR_FAILURE;
}
if (SetupRecording(fd) != NS_OK) {
DOM_CAMERA_LOGE("SetupRecording() failed\n");
close(fd);
return NS_ERROR_FAILURE;
}
nsresult rv = SetupRecording(fd);
NS_ENSURE_SUCCESS(rv, rv);
if (mRecorder->start() != OK) {
DOM_CAMERA_LOGE("mRecorder->start() failed\n");
close(fd);
return NS_ERROR_FAILURE;
}