The solution uses the patch in M2ts Writer
. Build libstagefright.so
and click on the device. Also below in the app
recorder.setAudioSamplingRate(48000); recorder.setAudioEncodingBitRate(128000);
otherwise it will not fully record the clip. I did not explain the reason for setting the above parameters.
Patch for M2tsWriter
in libstagefright
:
diff --git a/media/libstagefright/MPEG2TSWriter.cpp b/media/libstagefright/MPEG2TSWriter.cpp index c9ed5bb..a42371f 100644 --- a/media/libstagefright/MPEG2TSWriter.cpp +++ b/media/libstagefright/MPEG2TSWriter.cpp @@ -411,6 +411,7 @@ void MPEG2TSWriter::SourceInfo::onMessageReceived(const sp<AMessage> &msg) { (const uint8_t *)buffer->data() + buffer->range_offset(), buffer->range_length()); + readMore(); } else if (buffer->range_length() > 0) { if (mStreamType == 0x0f) { if (!appendAACFrames(buffer)) {
source share