Piasy
03/06/2025, 11:37 AM// common main
abstract class PeerConnectionClientFactory() {
data class Config(
val videoCaptureImpl: Int,
val videoCaptureWidth: Int,
val videoCaptureHeight: Int,
val videoCaptureFps: Int,
val initCameraFace: Int,
val privateConfig: PrivateConfig,
)
open class PrivateConfig
}
// mingw main
data class WinPrivateConfig(
internal val hwnd: COpaquePointer,
) : PeerConnectionClientFactory.PrivateConfig()
It seems impossible to create PeerConnectionClientFactory.Config
with WinPrivateConfig
, because the generated header file looks like this:
struct {
struct {
.....
} Companion;
kmp_webrtc_KType* (*_type)(void);
kmp_webrtc_kref_com_piasy_kmp_webrtc_PeerConnectionClientFactory_Config (*Config)(kmp_webrtc_KInt videoCaptureImpl, kmp_webrtc_KInt videoCaptureWidth, kmp_webrtc_KInt videoCaptureHeight, kmp_webrtc_KInt videoCaptureFps, kmp_webrtc_KInt initCameraFace, kmp_webrtc_kref_com_piasy_kmp_webrtc_PeerConnectionClientFactory_PrivateConfig privateConfig);
kmp_webrtc_KInt (*get_initCameraFace)(kmp_webrtc_kref_com_piasy_kmp_webrtc_PeerConnectionClientFactory_Config thiz);
kmp_webrtc_kref_com_piasy_kmp_webrtc_PeerConnectionClientFactory_PrivateConfig (*get_privateConfig)
.......
const char* (*toString)(kmp_webrtc_kref_com_piasy_kmp_webrtc_PeerConnectionClientFactory_Config thiz);
} Config;
struct {
kmp_webrtc_KType* (*_type)(void);
kmp_webrtc_kref_com_piasy_kmp_webrtc_PeerConnectionClientFactory_PrivateConfig (*PrivateConfig)();
} PrivateConfig;
struct {
kmp_webrtc_KType* (*_type)(void);
kmp_webrtc_kref_com_piasy_kmp_webrtc_WinPrivateConfig (*WinPrivateConfig)(void* hwnd);
kmp_webrtc_kref_com_piasy_kmp_webrtc_WinPrivateConfig (*copy)(kmp_webrtc_kref_com_piasy_kmp_webrtc_WinPrivateConfig thiz, void* hwnd);
kmp_webrtc_KBoolean (*equals)(kmp_webrtc_kref_com_piasy_kmp_webrtc_WinPrivateConfig thiz, kmp_webrtc_kref_kotlin_Any other);
kmp_webrtc_KInt (*hashCode)(kmp_webrtc_kref_com_piasy_kmp_webrtc_WinPrivateConfig thiz);
const char* (*toString)(kmp_webrtc_kref_com_piasy_kmp_webrtc_WinPrivateConfig thiz);
} WinPrivateConfig;
The “constructor” Config
method accept a kmp_webrtc_kref_com_piasy_kmp_webrtc_PeerConnectionClientFactory_PrivateConfig
, but kmp_webrtc_kref_com_piasy_kmp_webrtc_WinPrivateConfig
doesn’t have any relationship with it.
Although I can work around this with a kotlin method like this:
fun createPcClientFactoryConfig(
config: PeerConnectionClientFactory.Config, privateConfig: WinPrivateConfig
): PeerConnectionClientFactory.Config {
return PeerConnectionClientFactory.Config(
config.videoCaptureImpl, config.videoCaptureWidth, config.videoCaptureHeight, config.videoCaptureFps,
config.initCameraFace, privateConfig
)
}
Is this a designed behavior?Piasy
03/06/2025, 1:14 PMPiasy
03/10/2025, 12:22 PM