Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo4405 committed May 16, 2021
1 parent b002f83 commit bcc0c14
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 27 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ buildscript {

repositories {
google()
jcenter()
}

dependencies {
Expand All @@ -21,6 +22,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
}
}

Expand Down
1 change: 1 addition & 0 deletions haishinkit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ buildscript {

repositories {
google()
jcenter()
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,22 @@ data class AvcConfigurationRecord(
buffer.put(profileCompatibility)
buffer.put(avcLevelIndication)
buffer.put(lengthSizeMinusOneWithReserved)

// SPS
buffer.put(numOfSequenceParameterSetsWithReserved)
sequenceParameterSets?.forEach { sps ->
buffer.putShort(sps.size.toShort())
buffer.put(sps)
sequenceParameterSets?.let {
for (sps in it) {
buffer.putShort(sps.size.toShort())
buffer.put(sps)
}
}

// PPS
if (pictureParameterSets != null) {
buffer.put(pictureParameterSets.size.toByte())
pictureParameterSets.forEach { pps ->
pictureParameterSets?.let {
buffer.put(it.size.toByte())
for (pps in it) {
buffer.putShort(pps.size.toShort())
buffer.put(pps)
}
}

return this
}

Expand Down Expand Up @@ -87,11 +86,15 @@ data class AvcConfigurationRecord(

internal fun allocate(): ByteBuffer {
var capacity = 5
sequenceParameterSets?.forEach { sps ->
capacity += 3 + sps.size
sequenceParameterSets?.let {
for (sps in it) {
capacity += 3 + sps.size
}
}
pictureParameterSets?.forEach { pps ->
capacity += 3 + pps.size
pictureParameterSets?.let {
for (psp in it) {
capacity += 3 + psp.size
}
}
return ByteBuffer.allocate(capacity)
}
Expand All @@ -114,16 +117,20 @@ data class AvcConfigurationRecord(
}
val options = mutableListOf<CodecOption>()
val spsBuffer = ByteBuffer.allocate(128)
sequenceParameterSets?.forEach { sps ->
spsBuffer.put(AvcFormatUtils.START_CODE)
spsBuffer.put(sps)
sequenceParameterSets?.let {
for (sps in it) {
spsBuffer.put(AvcFormatUtils.START_CODE)
spsBuffer.put(sps)
}
}
spsBuffer.flip()
options.add(CodecOption(CSD0, spsBuffer))
val ppsBuffer = ByteBuffer.allocate(128)
pictureParameterSets?.forEach { pps ->
ppsBuffer.put(AvcFormatUtils.START_CODE)
ppsBuffer.put(pps)
pictureParameterSets?.let {
for (pps in it) {
ppsBuffer.put(AvcFormatUtils.START_CODE)
ppsBuffer.put((pps))
}
}
ppsBuffer.flip()
options.add(CodecOption(CSD1, ppsBuffer))
Expand All @@ -134,13 +141,17 @@ data class AvcConfigurationRecord(
internal fun toByteBuffer(): ByteBuffer {
val result = ByteBuffer.allocate(128)
result.put(0x00).put(0x00).put(0x00).put(0x00)
sequenceParameterSets?.forEach { sps ->
result.put(AvcFormatUtils.START_CODE)
result.put(sps)
sequenceParameterSets?.let {
for (sps in it) {
result.put(AvcFormatUtils.START_CODE)
result.put(sps)
}
}
pictureParameterSets?.forEach { pps ->
result.put(AvcFormatUtils.START_CODE)
result.put(pps)
pictureParameterSets?.let {
for (pps in it) {
result.put(AvcFormatUtils.START_CODE)
result.put(pps)
}
}
return result
}
Expand All @@ -149,6 +160,7 @@ data class AvcConfigurationRecord(
return ToStringBuilder.reflectionToString(this)
}

@Suppress("unused")
companion object {
const val RESERVE_LENGTH_SIZE_MINUS_ONE = 0x3F
const val RESERVE_NUM_OF_SEQUENCE_PARAMETER_SETS = 0xE0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ import kotlin.concurrent.schedule
/**
* flash.net.NetConnection for Kotlin
*/
@Suppress("unused")
open class RtmpConnection : EventDispatcher(null) {
/**
* NetStatusEvent#info.code for NetConnection
*/
@Suppress("unused")
enum class Code(val rawValue: String, val level: String) {
CALL_BAD_VERSION("NetConnection.Call.BadVersion", "error"),
CALL_FAILED("NetConnection.Call.Failed", "error"),
Expand All @@ -49,6 +51,7 @@ open class RtmpConnection : EventDispatcher(null) {
}
}

@Suppress("unused")
enum class SupportSound(val rawValue: Short) {
NONE(0x001),
ADPCM(0x002),
Expand All @@ -64,6 +67,7 @@ open class RtmpConnection : EventDispatcher(null) {
ALL(0x0FFF);
}

@Suppress("unused")
enum class SupportVideo(val rawValue: Short) {
UNUSED(0x001),
JPEG(0x002),
Expand Down Expand Up @@ -231,8 +235,8 @@ open class RtmpConnection : EventDispatcher(null) {
*/
open fun dispose() {
timerTask = null
streams.forEach {
it.value.dispose()
for (stream in streams) {
stream.value.dispose()
}
streams.clear()
}
Expand Down

0 comments on commit bcc0c14

Please sign in to comment.