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

Skip to content
Commit 28d4d67a authored by Gopalakrishnan Nallasamy's avatar Gopalakrishnan Nallasamy
Browse files

MPEG4Writer:64bit offset + fallocate

Use 64bit offset in mpeg4writer. Allows us to compose/mux files more
than 4GB in size.  Notify MediaMuxer and MediaRecorder users about any failure during
write() and seek(), with best effort attempt to save moov box.
SDK and NDK MediaMuxer.WriteSampleData() would throw IllegalStateException and return
INVALID_OPERATION as before, but in the very next call to this function after failure.
Earlier, writeSampleData wasn't aware of any write/seek failure.
SDK MediaMuxer.Stop() would throw relevant exception with error message.
NDK stop() would return relevant errors.
fallocate() is used to pre-allocate space for MOOV atom dynamically during
run time. If required space couldn't be allocated, then recording is
stopped and moov atom would be written to the file successfully.
Added logic to stop and release looper.

Bug: 135685864
Bug: 142060459
Bug: 142915394
Bug: 145235586

Test:  1) atest CtsMediaTestCases -- \
	--module-arg CtsMediaTestCases:size:small
       2) Composed files of size around 32GB using MediaMuxer and it is playing fine on the phone
       	and linux workstation.
       3) Filled up most of the flash memory in phone and tried to compose files using MediaMuxer
       	and MediaRecorder separately. Writing was stopped  when ::write failed due to out of space,
	and all threads exited gracefully in both cases. Expected errors were reported in Java layer.
       	(pre-allocation was disabled in this step).
       4) The same experiment as in step 3 with pre-allocation enabled, recording was stopped
	when there was not enough space and moov atom was written to the output file. File played
	well on phone and linux workstation.
       5) atest android.media.cts.MediaMuxerTest

Change-Id: I33de67d9dce3550ce3730a99c4aa92bc71c9f7b8
parent 990cc725
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment