How to retrieve camera resolution without changing the aspect ratio according to default ratio

We need to retrieve resolution of the selected camera for our project so we used CameraStreamResolution sample as reference. While that method works for retrieving the image resolution, it seems like the aspect ratio is locked at 16:9 (for example 1920 x 1080 res frame is retrieved as 1920 x 1080 but 1280 x 1024 is retrieved as 1280 x 720 etc). We realize that there are functions exists to keep the aspect ratio of the retrieved frame but since they required to be called before initialization (with predefined width and height to work), they are not usefull to us. Is it possible to get the resolution of the camera without predefining an aspect ratio and resolution?

static void GetRes()
    {
      var jpegSource = new JPEGVideoSource(_camera);
      jpegSource.Init();
      jpegSource.Height = 0;
      jpegSource.Width = 0;
      Console.WriteLine("Asking for the last recorded image from camera {0} ",
       _camera.Name);
      var jpegData = jpegSource.GetEnd(); // jpegData is locked 16:9 ratio 
      if (jpegData == null)
      {
        Console.WriteLine("No recorded image from " + _camera.Name);
      }
      else
      {
        Console.WriteLine("The resolution of the last recorded image " +
                 "from camera {0} is ({1},{2})" + Environment.NewLine,
                 _camera.Name,
                 jpegData.Width,
                 jpegData.Height);
      }
    }

You might already know but let me explain the flow of recording.

First of all, it is possible to set up resolution in Management Client (see below).

Recording server (RS) gets this setting from Management Client and communicates with cameras. It also asks for images from the cameras according to the settings and store the images.

One more thing. In the code that you showed us, jpegSource.Height and Width are defined as 0 -

 jpegSource.Height = 0;

 jpegSource.Width = 0;

You can define them any size as you want if you want to have a certain size for the image.