mirror of
https://github.com/samsonjs/media.git
synced 2026-04-05 11:15:46 +00:00
Minor cleanup of AudioTrack.
This commit is contained in:
parent
ee823a95fc
commit
4d6c9f27c2
1 changed files with 6 additions and 7 deletions
|
|
@ -361,9 +361,12 @@ public final class AudioTrack {
|
|||
* written data.
|
||||
*/
|
||||
public int handleBuffer(ByteBuffer buffer, int offset, int size, long presentationTimeUs) {
|
||||
int result = 0;
|
||||
if (size == 0) {
|
||||
return RESULT_BUFFER_CONSUMED;
|
||||
}
|
||||
|
||||
if (temporaryBufferSize == 0 && size != 0) {
|
||||
int result = 0;
|
||||
if (temporaryBufferSize == 0) {
|
||||
if (isAc3 && ac3Bitrate == UNKNOWN_AC3_BITRATE) {
|
||||
// Each AC-3 buffer contains 1536 frames of audio, so the AudioTrack playback position
|
||||
// advances by 1536 per buffer (32 ms at 48 kHz). Calculate the bitrate in kbit/s.
|
||||
|
|
@ -393,15 +396,11 @@ public final class AudioTrack {
|
|||
// number of bytes submitted.
|
||||
startMediaTimeUs += (bufferStartTime - expectedBufferStartTime);
|
||||
startMediaTimeState = START_IN_SYNC;
|
||||
result = RESULT_POSITION_DISCONTINUITY;
|
||||
result |= RESULT_POSITION_DISCONTINUITY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (size == 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (temporaryBufferSize == 0) {
|
||||
temporaryBufferSize = size;
|
||||
buffer.position(offset);
|
||||
|
|
|
|||
Loading…
Reference in a new issue