Xamarin应用程序传递了NULL表面

时间:2017-09-08 23:17:20

标签: c# android android-fragments xamarin camera

我想知道是否有人可以帮我解决当前的问题。

我是android开发的新手,并没有完全理解android与相机一起工作的方式。

希望这是一个简单的错误。我一直在Github - Google

上关注这个例子

虽然我不得不修改示例以满足我的需求。主要用C#编写。并从片段中运行条形码检测器。

初始化相机时,提供以下日志:

我认为主要问题是相机正在传递一个零空间表面。这是我不明白的地方,因为表面上的人是从我能够正确说出的内容中提出来的。

虽然当我在debuger中查看它时,表面框架是空的,并且持有者无效。我认为它可能与从一个片段中进行过分析有关,尽管我已经尝试在为Activity.BaseContext创建barcodeFragmentActivity时更改上下文。这没什么区别。

09-08 23:51:19.597 D/Camera  (30433): app passed NULL surface
09-08 23:51:20.049 D/Mono    (30433): GC_BRIDGE waiting for bridge  processing to finish
09-08 23:51:20.057 I/art     (30433): Starting a blocking GC Explicit
09-08 23:51:20.099 I/art     (30433): Explicit concurrent mark sweep GC freed 2409(108KB) AllocSpace objects, 4(8MB) LOS objects, 30% free, 37MB/53MB, paused 245us total 41.233ms
09-08 23:51:20.100 D/Mono    (30433): GC_TAR_BRIDGE bridges 241 objects 245 opaque 5 colors 240 colors-bridged 240 colors-visible 240 xref 12 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.16ms tarjan 0.53ms scc-setup 0.21ms gather-xref 0.02ms xref-setup 0.02ms cleanup 0.08ms
09-08 23:51:20.100 D/Mono    (30433): GC_BRIDGE: Complete, was running for 50.79ms
09-08 23:51:20.100 D/Mono    (30433): GC_MAJOR_SWEEP: major size: 1024K in use: 633K
09-08 23:51:20.101 D/Mono    (30433): GC_MAJOR: (mature allocation failure) time 33.83ms, stw 36.81ms los size: 10144K in use: 9135K
09-08 23:51:23.320 D/ViewRootImpl@6738e29[BarcodeFragmentActivity](30433): ThreadedRenderer.create() translucent=false
09-08 23:51:23.329 D/InputTransport(30433): Input channel constructed: fd=79
09-08 23:51:23.330 D/ViewRootImpl@6738e29[BarcodeFragmentActivity](30433): setView = DecorView@13a35ae[BarcodeFragmentActivity] touchMode=true
09-08 23:51:23.359 I/Choreographer(30433): Skipped 700 frames!  The application may be doing too much work on its main thread.
09-08 23:51:23.389 D/ViewRootImpl@4b64d36[MainActivity](30433): mHardwareRenderer.destroy()#1
09-08 23:51:23.408 D/ViewRootImpl@4b64d36[MainActivity](30433): Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x5 surface={isValid=false 0} surfaceGenerationChanged=true
09-08 23:51:23.412 D/ViewRootImpl@6738e29[BarcodeFragmentActivity](30433): dispatchAttachedToWindow
09-08 23:51:23.426 D/ViewRootImpl@6738e29[BarcodeFragmentActivity](30433): Relayout returned: oldFrame=[0,0][0,0] newFrame=[0,0][1440,2560] result=0x7 surface={isValid=true 536149920256} surfaceGenerationChanged=true
09-08 23:51:23.427 D/ViewRootImpl@6738e29[BarcodeFragmentActivity](30433): mHardwareRenderer.initialize() mSurface={isValid=true 536149920256} hwInitialized=true
09-08 23:51:23.429 D/mali_winsys(30433): EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000,  [1440x2560]-format:1
09-08 23:51:23.431 I/mono-stdout(30433): MSurfaceView Is not null
MSurfaceView Is not null
09-08 23:51:23.432 I/mono-stdout(30433): Drawing the Layout
Drawing the Layout
09-08 23:51:23.433 I/mono-stdout(30433): StockApp.UI.CameraSource
StockApp.UI.CameraSource
09-08 23:51:23.441 I/mono-stdout(30433): 1440x1080Starting If Ready
1440x1080Starting If Ready
09-08 23:51:23.443 I/mono-stdout(30433): mStartRequested : False ,         mSurfaceAvailabe : True
mStartRequested : False , mSurfaceAvailabe : True
09-08 23:51:23.444 I/mono-stdout(30433): Before Camera Call, @110
Before Camera Call, @110
09-08 23:51:23.825 I/mono-stdout(30433): After Camera Call, @112
After Camera Call, @112
09-08 23:51:23.831 E/ViewRootImpl(30433): sendUserActionEvent() mView == null
09-08 23:51:23.831 E/ViewRootImpl(30433): sendUserActionEvent() mView == null
09-08 23:51:23.882 D/OpenCameraSource(30433): Skipping Frame, Could not Find ByteBuffer Associated with image
09-08 23:51:23.895 D/OpenCameraSource(30433): Skipping Frame, Could not Find ByteBuffer Associated with image
09-08 23:51:23.908 D/OpenCameraSource(30433): Skipping Frame, Could not Find ByteBuffer Associated with image
09-08 23:51:23.919 D/OpenCameraSource(30433): Skipping Frame, Could not Find ByteBuffer Associated with image
09-08 23:51:23.941 D/ViewRootImpl@6738e29[BarcodeFragmentActivity](30433): Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x1 surface={isValid=true 536149920256} surfaceGenerationChanged=false
09-08 23:51:23.982 D/ViewRootImpl@6738e29[BarcodeFragmentActivity](30433): MSG_RESIZED_REPORT: ci=Rect(0, 96 - 0, 0) vi=Rect(0, 96 - 0, 0) or=1
09-08 23:51:23.983 D/ViewRootImpl@6738e29[BarcodeFragmentActivity](30433): MSG_WINDOW_FOCUS_CHANGED 1
09-08 23:51:23.984 D/ViewRootImpl@6738e29[BarcodeFragmentActivity](30433): mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true 536149920256}
09-08 23:51:23.985 V/InputMethodManager(30433): Starting input: tba=android.view.inputmethod.EditorInfo@4b80f4f nm : StockApp.StockApp ic=null
09-08 23:51:23.985 I/InputMethodManager(30433): [IMM] startInputInner - mService.startInputOrWindowGainedFocus
09-08 23:51:23.991 D/InputTransport(30433): Input channel constructed: fd=78
09-08 23:51:23.992 D/InputTransport(30433): Input channel destroyed: fd=63

我不想太过于混乱,所以我认为重要的代码是:

UI/CameraSource.cs
UI/CameraSourcePreview.cs
BarcodeReader/BarcodeFragmentActivity.cs
BarcodeReader/BarcodeFragment.cs

github - Code

0 个答案:

没有答案