Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import android.graphics.Rect
import android.hardware.HardwareBuffer
import android.media.Image
import android.os.Build
import android.os.Build.VERSION_CODES
import androidx.camera.camera2.pipe.StreamFormat
import androidx.camera.camera2.pipe.compat.Api28Compat
import java.nio.ByteBuffer
Expand Down Expand Up @@ -93,9 +92,9 @@ public class AndroidImage(private val image: Image) : ImageWrapper {
get() = readPlanes()

override fun toString(): String {
// Image will be written as "Image-YUV_444_888w640h480-1234567890" with format, width,
// Image will be written as "Image-YUV_444_888w640h480-t1234567890" with format, width,
// height, and timestamp
return "Image-${StreamFormat(format).name}-w${width}h$height-$timestamp"
return "Image-${StreamFormat(format).name}-w${width}h$height-t$timestamp"
}

override fun close() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.camera.camera2.pipe.core.Log
import androidx.camera.camera2.pipe.core.Threads
import androidx.camera.camera2.pipe.media.AndroidImageReader.Companion.IMAGEREADER_MAX_CAPACITY
import androidx.camera.camera2.pipe.media.ImageReaderImageSource.Companion.IMAGE_SOURCE_CAPACITY
import androidx.camera.camera2.pipe.media.OutputImage.Companion.toLogString
import javax.inject.Inject
import kotlin.reflect.KClass
import kotlinx.atomicfu.atomic
Expand Down Expand Up @@ -261,6 +262,8 @@ public class ImageReaderImageSource(
// Wrapper images that are no longer reachable should be closed to avoid memory leaks.
close()
}

override fun toString(): String = this.toLogString()
}

private enum class State {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ public interface OutputImage : ImageWrapper {
ImageWrapper::class -> this as T?
else -> image.unwrapAs(type)
}

override fun toString(): String = this.toLogString()
}

@Suppress("NOTHING_TO_INLINE")
internal inline fun OutputImage.toLogString(): String {
// Output Image will be written as "OutputImage-s42_o45-t1234567890" where
// s42 is StreamId-42
// o45 is OutputId-45
// t1234567890 is the nanosecond timestamp of the image.
return "OutputImage-s${streamId.value}_o${outputId.value}-t$timestamp"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ public interface SharedOutputImage : OutputImage {
sharedReference.decrement()
}
}

override fun toString(): String = outputImage.toString()
}
}
}
Loading