private void StartIfReady()
 {
     if (_startRequested && SurfaceAvailable)
     {
         _cameraSource.Start(_surfaceView.Holder);
         if (_overlay != null)
         {
             var size = _cameraSource.PreviewSize;
             var min  = Math.Min(size.Width, size.Height);
             var max  = Math.Max(size.Width, size.Height);
             if (IsPortraitMode())
             {
                 // Swap width and height sizes when in portrait, since it will be rotated by
                 // 90 degrees
                 _overlay.SetCameraInfo(min, max, _cameraSource.CameraFacing);
             }
             else
             {
                 _overlay.SetCameraInfo(max, min, _cameraSource.CameraFacing);
             }
             _overlay.Clear();
         }
         _startRequested = false;
     }
 }