Skip to content

Commit

Permalink
update common test
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroSG94 committed Sep 30, 2024
1 parent b99341c commit 897f069
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions common/src/test/java/com/pedro/common/ExtensionTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.pedro.common

import android.media.MediaCodec
import com.pedro.common.frame.MediaFrame
import org.junit.Assert.assertEquals
import org.junit.Test
import java.nio.ByteBuffer
Expand All @@ -29,14 +29,9 @@ class ExtensionTest {
@Test
fun `remove info`() {
val buffer = ByteBuffer.wrap(ByteArray(256) { 0x00 }.mapIndexed { index, byte -> index.toByte() }.toByteArray())
val info = MediaCodec.BufferInfo()
val offset = 4
val minusLimit = 2
info.presentationTimeUs = 0
info.offset = offset
info.size = buffer.remaining() - minusLimit
info.flags = 0

val info = MediaFrame.Info(4, buffer.remaining() - minusLimit, 0, 0)
val result = buffer.removeInfo(info)
assertEquals(buffer.capacity() - offset - minusLimit, result.remaining())
assertEquals(offset.toByte(), result.get(0))
Expand Down

0 comments on commit 897f069

Please sign in to comment.