diff --git a/android/src/main/java/com/brentvatne/common/api/BufferConfig.kt b/android/src/main/java/com/brentvatne/common/api/BufferConfig.kt index 4730e9f1..4cb33ea4 100644 --- a/android/src/main/java/com/brentvatne/common/api/BufferConfig.kt +++ b/android/src/main/java/com/brentvatne/common/api/BufferConfig.kt @@ -23,6 +23,23 @@ class BufferConfig { var live: Live = Live() + /** return true if this and src are equals */ + override fun equals(other: Any?): Boolean { + if (other == null || other !is BufferConfig) return false + return ( + cacheSize == other.cacheSize && + minBufferMs == other.minBufferMs && + maxBufferMs == other.maxBufferMs && + bufferForPlaybackMs == other.bufferForPlaybackMs && + bufferForPlaybackAfterRebufferMs == other.bufferForPlaybackAfterRebufferMs && + backBufferDurationMs == other.backBufferDurationMs && + maxHeapAllocationPercent == other.maxHeapAllocationPercent && + minBackBufferMemoryReservePercent == other.minBackBufferMemoryReservePercent && + minBufferMemoryReservePercent == other.minBufferMemoryReservePercent && + live == other.live + ) + } + class Live { var maxPlaybackSpeed: Float = BufferConfigPropUnsetDouble.toFloat() var minPlaybackSpeed: Float = BufferConfigPropUnsetDouble.toFloat() @@ -30,6 +47,17 @@ class BufferConfig { var minOffsetMs: Long = BufferConfigPropUnsetInt.toLong() var targetOffsetMs: Long = BufferConfigPropUnsetInt.toLong() + override fun equals(other: Any?): Boolean { + if (other == null || other !is Live) return false + return ( + maxPlaybackSpeed == other.maxPlaybackSpeed && + minPlaybackSpeed == other.minPlaybackSpeed && + maxOffsetMs == other.maxOffsetMs && + minOffsetMs == other.minOffsetMs && + targetOffsetMs == other.targetOffsetMs + ) + } + companion object { private const val PROP_BUFFER_CONFIG_LIVE_MAX_PLAYBACK_SPEED = "maxPlaybackSpeed" private const val PROP_BUFFER_CONFIG_LIVE_MIN_PLAYBACK_SPEED = "minPlaybackSpeed"