dji-sdk / Onboard-SDK

DJI Onboard SDK Official Repository
https://github.com/dji-sdk/Onboard-SDK
Other
914 stars 631 forks source link

Mismatched timestamp types causes issues with VGA stereo on M300 #775

Open Isokratia opened 3 years ago

Isokratia commented 3 years ago

The timestamp in ImageInfoType is 64-bit and the timestamp in StereoVGAImgData is 32-bit

typedef struct ImageInfoType {
    RawImageInfoType rawInfo;
    uint16_t dataId;
    uint16_t sequence;
    CamPositionType dataType;
    uint64_t timeStamp;   // <----
  } ImageInfoType;
  typedef struct StereoVGAImgData
  {
      uint32_t frame_index;
      uint32_t time_stamp; // <----
      uint8_t  num_imgs;
      uint8_t  direction;
      // @note VGA imgs always come in pair
      VGAImage img_vec[2];
  } StereoVGAImgData; // pack(1)

This causes time-sync comparison issues in dji_advanced_sensing.cpp:289 when the incoming timestamp from ImageInfoType is larger than 32-bits (the 32-bit int is promoted to 64-bit for the comparison and the two don't match). The time-sync check on the stereo images fails and the VGA stereo pairs don't get published.

(stereoVGAImg.time_stamp == info.timeStamp) should be (stereoVGAImg.time_stamp == static_cast<uint32_t>(info.timeStamp)), which fixes the issue.

dji-dev commented 3 years ago

Agent comment from kyle.cai in Zendesk ticket #48287:

Dear developer ,

Thank you for contacting DJI.

We will submit it for review again, thanks for your feedback.

Thank you for your understanding and support, hope you have a nice day.

Best Regards, DJI SDK Support Team

°°°