Skip to content

Commit

Permalink
Changed Calender getMilliSecond to System getMilliSeconds
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchay97-dev committed Dec 2, 2024
1 parent 4a2b2e0 commit 28796c5
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions app/src/main/java/com/facebook/encapp/BufferTranscoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ void bufferTranscoding(int trackIndex) throws IOException {
throw new IllegalStateException("Could not retrieve clip duration.");
}

long starttime = Calendar.getInstance().getTimeInMillis();
long starttime = System.currentTimeMillis();
// long temp = mTest.getInput().getLoopbackTotalDuration();
// Log.d(TAG, "totalDurationUs : " + temp);
while (accumulatedDurationUs < totalDurationUs) {
Expand All @@ -727,20 +727,6 @@ void bufferTranscoding(int trackIndex) throws IOException {
// Flush the decoder to reset its state
mDecoder.flush();

// mExtractor.release();
//
// mExtractor = new MediaExtractor();
//
// mExtractor.setDataSource(mTest.getInput().getFilepath());
// mExtractor.selectTrack(trackIndex);

// Seek back to the start for loopback
// mExtractor.seekTo(0, MediaExtractor.SEEK_TO_CLOSEST_SYNC);

// End of stream reached; perform loopback
// lastPresentationTimeUs += clipDurationUs;
// accumulatedDurationUs += clipDurationUs;

// Reset the error counter and add a small delay
consecutive = 0;
try {
Expand Down Expand Up @@ -782,12 +768,13 @@ void bufferTranscoding(int trackIndex) throws IOException {
// End of stream reached; perform loopback
lastPresentationTimeUs += clipDurationUs;

long loopback_finished = Calendar.getInstance().getTimeInMillis();
long loopback_finished = System.currentTimeMillis();
long elapsed_time = (loopback_finished - starttime) * 1000;

starttime = loopback_finished;
// starttime = loopback_finished;

accumulatedDurationUs += elapsed_time;
accumulatedDurationUs = elapsed_time;
Log.d(TAG, "current accumulatedDurationUs : " + accumulatedDurationUs);
// **Note** : Run loopback till it exceeds totalDuration.
// And Don't do accumulatedDurationUs += clipDurationUs;
// Need to test with multiple test in pbtxt.
Expand Down Expand Up @@ -1337,6 +1324,7 @@ void submitFrameForEncoding(MediaMuxer muxer, int videoTrackIndex, FileOutputStr
}

if(muxer != null) {
// Note : This is done to skip the mp4 output file creation
// muxer.writeSampleData(videoTrackIndex, buffer, info);
// fileOutputStream.write(buffer.array(), 0, encodedBufferSize);
}
Expand Down Expand Up @@ -1426,6 +1414,7 @@ void getEncodedFrame() {
if (mMuxer != null && mVideoTrack != -1) {
++mOutFramesCount;
ByteBuffer data = mCodec.getOutputBuffer(index);
// Note : This is done to skip the mp4 output file creation
// mMuxer.writeSampleData(mVideoTrack, data, info);
//Log.d(TAG, "Muxer writing to file Frame No:: " + mOutFramesCount + " encoded o/p size: " +data.limit());
Log.d(TAG, "Muxer writing to file Frame No:: " + framesWritten);
Expand Down

0 comments on commit 28796c5

Please sign in to comment.