Adobe AIR的摄像头缓慢缓慢、摄像头、Adobe、AIR

2023-09-09 21:52:30 作者:我的世界不允许你消失

我有使用的相机问题的 Adob​​e AIR的移动设备的。

I am having issues with using the camera on Adobe AIR mobile devices.

相机的性能是确定在较新的手机,但上GALAXY S2例如它不可能使用。我现在用的是相机是这样的:

The performance of the camera is ok on newer phones, but on galaxy s2 for example it is impossible to use. I am using the camera like this:

 _camera = Camera.getCamera("0");
    if (_camera != null)
    {

//      _video = new Video();
        _video = new Video(_camera.width, _camera.height);
//      _video.width = _cameraHeight;
        _video.width = _cameraHeight;
        _video.height = Starling.current.nativeStage.fullScreenWidth;
        _camera.addEventListener(ActivityEvent.ACTIVITY, onCameraActivity);
        _camera.setMode( _video.width,_video.height, 30 );
        _video.attachCamera(_camera);
        _videoContainer.addChild(_video);
    }

有没有人有什么建议?

Does anyone have any recommendations?

编辑:问题是,帧率下降到1左右银河S2和应用程序崩溃。在我的Galaxy S3它能解决30fps的。我也试过在每一帧通过上传视频到GPU

The problem is that the framerate drops to around 1 on Galaxy S2 and the app crashes. On my galaxy S3 it works around 30fps. I also tried uploading the video to the GPU on every frame using

flash.display3D.textures.Texture(image.texture.base).uploadFromBitmapData(bmd);

它变得更好我的银河S3那么,FPS大约是50-60,但GALAXY S2静得可怕和不可用(约1 FPS)

it gets better on my galaxy s3 then, fps is around 50-60, but on galaxy s2 still terrible and unusable(around 1 fps)

推荐答案

如果你实际使用的椋鸟,这是我以前用过的(项目约半岁,不知道如果事情发生太大的变化)

If you are actually using Starling, this is what I've used before (project about half an year old, don't know if things changed that much):

camera = Camera.getCamera();
camera.setLoopback(false);
camera.setMode(640, 640, 15);
var cropping:Rectangle = new Rectangle(0, 0, getLowerPowerOfTwo(camera.width), getLowerPowerOfTwo(camera.height));
webcamVideo = new WebcamVideo(  camera, 
                                new Rectangle(
                                    (camera.width - cropping.width) * .5,
                                    (camera.height - cropping.height) * .5,
                                    cropping.width,
                                    cropping.height),
                                false,
                                 WebcamVideo.DRAW_BITMAPDATA|WebcamVideo.UPLOAD_FROM_BITMAPDATA);

帧速率设置为15,但如果你尝试,你可以看到这个结果并不坏。而我给自己定的,因为我是测试在一个旧HTC感觉(3岁),S2和另一个老,我忘了其实它15。您可以检查硬件,如果需要提高了。在的HTC One它就像一个魅力30。

The frame rate is set to 15, but if you try you can see that the result is not that bad. And I've set it to 15, because of the fact that I was testing on an old HTC Sensation (3 years old), S2 and another one old that I forgot. You can check the hardware and boost up if needed. On HTC One it works like a charm at 30.

试试看吧,我希望它能帮助! :)

Give it a try, I hope it helps! :)