diff options
author | Marco Nelissen <marcone@google.com> | 2014-12-10 11:05:32 -0800 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2014-12-10 11:05:32 -0800 |
commit | 69113e8ccc30fbdb8733ca2070bd3491b21e656d (patch) | |
tree | badaf6dd1aaaed21ad560e36a76354646b447ca4 | |
parent | f888020c6e2735624f2b2a30e72aca24e17b8b4d (diff) | |
download | frameworks_av-69113e8ccc30fbdb8733ca2070bd3491b21e656d.zip frameworks_av-69113e8ccc30fbdb8733ca2070bd3491b21e656d.tar.gz frameworks_av-69113e8ccc30fbdb8733ca2070bd3491b21e656d.tar.bz2 |
Truncate file before recording into it.
Recording into an existing file of non-zero length could leave old
data in the file after the recording ends. Best case that wastes
space, worst case it results in a file that's considered corrupt
on playback.
Change-Id: I2c77a107603b2b36790958360ff0856c2b28d677
-rw-r--r-- | media/libmediaplayerservice/StagefrightRecorder.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp index cadd691..de25291 100644 --- a/media/libmediaplayerservice/StagefrightRecorder.cpp +++ b/media/libmediaplayerservice/StagefrightRecorder.cpp @@ -260,6 +260,9 @@ status_t StagefrightRecorder::setOutputFile(int fd, int64_t offset, int64_t leng return -EBADF; } + // start with a clean, empty file + ftruncate(fd, 0); + if (mOutputFd >= 0) { ::close(mOutputFd); } |