@@ -5,9 +5,9 @@ import java.util.concurrent.PriorityBlockingQueue
55import java.util.concurrent.atomic.AtomicBoolean
66import kotlin.math.max
77
8- class StreamBlockingQueue (var size : Int ) {
8+ class StreamBlockingQueue (var capacity : Int ) {
99
10- private val queue = PriorityBlockingQueue <MediaFrame >(size ) { p0, p1 ->
10+ private val queue = PriorityBlockingQueue <MediaFrame >(capacity ) { p0, p1 ->
1111 p0.info.timestamp.compare(p1.info.timestamp)
1212 }
1313 private var cacheQueue = PriorityBlockingQueue <MediaFrame >(200 ) { p0, p1 ->
@@ -18,7 +18,7 @@ class StreamBlockingQueue(var size: Int) {
1818 private var startTs = 0L
1919
2020 fun trySend (item : MediaFrame ): Boolean {
21- if (queue.size >= size ) return false
21+ if (queue.size >= capacity ) return false
2222 if (cacheTime > 0 && ! cacheTimeFilled.get()) {
2323 if (startTs == 0L ) startTs = TimeUtils .getCurrentTimeMillis()
2424 val t = TimeUtils .getCurrentTimeMillis() - startTs
@@ -39,7 +39,7 @@ class StreamBlockingQueue(var size: Int) {
3939 return queue.take()
4040 }
4141
42- fun remainingCapacity (): Int = max(0 , size - queue.size)
42+ fun remainingCapacity (): Int = max(0 , capacity - queue.size)
4343
4444 fun drainTo (destiny : StreamBlockingQueue ) {
4545 queue.drainTo(destiny.queue)
0 commit comments