Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d5d3b7c authored by Robert Shih's avatar Robert Shih
Browse files

MediaRecorder: use fd from RandomAccessFile

Use RandomAccessFile instead of FileOutputStream so the underlying fd
is opened O_RDWR; O_RDWR is needed for mmap calls in the native webm
writer.

Change-Id: I444cbf40add96bc05905369ae2fa2b5446b0f9cc
parent f76ba856
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -25,8 +25,8 @@ import android.util.Log;
import android.view.Surface;

import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.lang.ref.WeakReference;

/**
@@ -713,11 +713,11 @@ public class MediaRecorder
    public void prepare() throws IllegalStateException, IOException
    {
        if (mPath != null) {
            FileOutputStream fos = new FileOutputStream(mPath);
            RandomAccessFile file = new RandomAccessFile(mPath, "rws");
            try {
                _setOutputFile(fos.getFD(), 0, 0);
                _setOutputFile(file.getFD(), 0, 0);
            } finally {
                fos.close();
                file.close();
            }
        } else if (mFd != null) {
            _setOutputFile(mFd, 0, 0);