About the role of the cache time

1. Due to network fluctuations, audio and video frames usually do not reach the mobile phone at a constant speed. In order to ensure smooth preview, the SDK will cache a small number of frames and try to send the frames to the App at a constant speed.

For example, for a stream of 30 frames per second, the SDK tries to ensure that a frame is sent to the App every 33 milliseconds.

2. Due to the performance of the mobile phone, or in some cases, hardware decoding cannot be used (such as trying to use software to decode a large-size JPEG stream from USB), which may cause some processing time to be too long, causing the App to fail to retrieve frames in time, or SDK Can’t send out frames in time, then at this time, the SDK will discard some frames in a reasonable way when the cache exceeds the cache time, so that the user will not feel that the preview delay is infinitely lengthened.

The Caching Time API

1. The class
  1. ICatchPancamConfig

2. The method

2.1 For C++

  1. bool setPreviewCacheParam(int32_t cacheTimeInMs, int32_t dropFrameTimeOverMs = 200);

Usage: ICatchPancamConfig::getInstance()->setPreviewCacheParam(200, 200); // Set preview caching time to 200ms

2.2 For Java

  1. public boolean setPreviewCacheParam(int cacheTimeInMs, int dropFrameTimeOverMs)

Usage: ICatchPancamConfig.getInstance().setPreviewCacheParam(200, 200); // Set preview caching time to 200ms

2.3 Parameters:

  1. cachingTimeInMs: The caching time of the preview stream.
  2. dropFrameTimeOverMs: The parameter is deprecated, value will be ignored.

~~

Some other notes

  1. This API should be called before you start the preview stream.