MPEG4Writer:Ignore sample table of malformed track

1. Don't write sample table box for malformed tracks.
   Return error to the client about malformed track.
   MOOV atom would be finalized with other well-formed tracks.
2. Throw relevant track id and recorder-error on error while making
   codec specific data from input buffers for AVC, HEIC, HEVC and MPEG4.
3. Capture and log errors returned by system calls.
4. Bubble up other relevant errors.
5. Good to release internal buffer and stop source before notifying client.
6. Don't need to update filesize for every preallocation.
   Use fallocate in FALLOC_FL_KEEP_SIZE mode.
7. Added some important logs
8. Added and corrected some comments.
9. Added TrackId subclass to validate track ids for MediaRecorder and
   MediaMuxer.

Bug: 153923798
Bug: 156657952

Test: atest android.media.cts.MediaMuxerTest
      atest android.media.cts.MediaRecorderTest
      atest android.mediav2.cts.MuxerTest

Change-Id: I87f9b8cc9cbd23789f7fb69490e8a6f81469907a
6 files changed