fix lint errors

This commit is contained in:
Siyuan 2025-09-25 23:28:30 +00:00
parent 8f8a743ee6
commit 227409e2e8
2 changed files with 11 additions and 12 deletions

View File

@ -37,14 +37,14 @@ func NewNative(opts NativeOptions) *Native {
onVideoStateChange := opts.OnVideoStateChange onVideoStateChange := opts.OnVideoStateChange
if onVideoStateChange == nil { if onVideoStateChange == nil {
onVideoStateChange = func(state VideoState) { onVideoStateChange = func(state VideoState) {
nativeLogger.Info().Msg("video state changed") nativeLogger.Info().Interface("state", state).Msg("video state changed")
} }
} }
onVideoFrameReceived := opts.OnVideoFrameReceived onVideoFrameReceived := opts.OnVideoFrameReceived
if onVideoFrameReceived == nil { if onVideoFrameReceived == nil {
onVideoFrameReceived = func(frame []byte, duration time.Duration) { onVideoFrameReceived = func(frame []byte, duration time.Duration) {
nativeLogger.Info().Msg("video frame received") nativeLogger.Info().Interface("frame", frame).Dur("duration", duration).Msg("video frame received")
} }
} }
@ -69,10 +69,10 @@ func NewNative(opts NativeOptions) *Native {
systemVersion: opts.SystemVersion, systemVersion: opts.SystemVersion,
appVersion: opts.AppVersion, appVersion: opts.AppVersion,
displayRotation: opts.DisplayRotation, displayRotation: opts.DisplayRotation,
onVideoStateChange: opts.OnVideoStateChange, onVideoStateChange: onVideoStateChange,
onVideoFrameReceived: opts.OnVideoFrameReceived, onVideoFrameReceived: onVideoFrameReceived,
onIndevEvent: opts.OnIndevEvent, onIndevEvent: onIndevEvent,
onRpcEvent: opts.OnRpcEvent, onRpcEvent: onRpcEvent,
videoLock: sync.Mutex{}, videoLock: sync.Mutex{},
screenLock: sync.Mutex{}, screenLock: sync.Mutex{},
} }
@ -93,7 +93,9 @@ func (n *Native) Start() {
n.initUI() n.initUI()
go n.tickUI() go n.tickUI()
videoInit() if err := videoInit(); err != nil {
n.l.Error().Err(err).Msg("failed to initialize video")
}
close(n.ready) close(n.ready)
} }

View File

@ -366,15 +366,12 @@ func (s *NetworkInterfaceState) updateNtpServersFromLease(lease *udhcpc.Lease) e
} }
func (s *NetworkInterfaceState) handleInitialCheck() { func (s *NetworkInterfaceState) handleInitialCheck() {
if s.IsUp() { // if s.IsUp() {}
}
s.onInitialCheck(s) s.onInitialCheck(s)
} }
func (s *NetworkInterfaceState) handleStateChange() { func (s *NetworkInterfaceState) handleStateChange() {
if s.IsUp() { // if s.IsUp() {} else {}
} else {
}
s.onStateChange(s) s.onStateChange(s)
} }