Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tretdm committed Apr 25, 2024
1 parent 236a516 commit 4e06fea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ private void renderAudio(final byte[] buffer, final int length) {

audio_track = new AudioTrack(AudioManager.STREAM_MUSIC, (int) track.sample_rate,
ch_config,
AudioFormat.ENCODING_PCM_16BIT, length * 2, AudioTrack.MODE_STREAM);
AudioFormat.ENCODING_PCM_16BIT, length, AudioTrack.MODE_STREAM);

minAudioBufferSize = AudioRecord.getMinBufferSize(
(int) (track.sample_rate),
Expand Down Expand Up @@ -352,6 +352,8 @@ private void renderVideo(final byte[] buffer, final int length) {
} else {
Log.d(MPLAY_TAG, "Video frame buffer is null");
}

Thread.sleep((long) (800 / track.frame_rate));
} catch (Exception ex) {
ex.printStackTrace();
} catch (OutOfMemoryError oom) {
Expand Down
2 changes: 1 addition & 1 deletion ndk-modules/ovkmplayer/decoders/audiodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void *AudioDecoder::decodeInThread() {
);
memcpy(gBuffer, buffer, dataSize);
av_free(buffer);
gInterface->onStreamDecoding((uint8_t*)gBuffer, dataSize / 2, gStreamIndex);
gInterface->onStreamDecoding((uint8_t*)gBuffer, dataSize, gStreamIndex);
}
}
// Free the packet that was allocated by av_read_frame
Expand Down

0 comments on commit 4e06fea

Please sign in to comment.