Method for managing data drop rate, client device, and computer readable storage medium
The embodiments of the disclosure provide a method for managing data drop rate, a client device, and a computer readable storage medium. The method includes: determining, by the client device, a first data component corresponding to a t-th time point and a second data component, wherein the first data component belongs to a first data type, and the second data component belongs to the first data type or a second data type; sending, by the client device, a first data packet to a host at the t-th time point, wherein the first data packet comprises a first payload having a fixed size, and the first payload comprises the first data component and the second data component.
1 . A method for managing data drop rate, applied to a client device, comprising:
determining, by the client device, a first data component corresponding to a t-th time point and a second data component, wherein the first data component belongs to a first data type, and the second data component belongs to the first data type or a second data type, and t is an index, wherein the first data component corresponding to the t-th time point and other first data components respectively belonging to the first data type and corresponding to other time points have a same size, wherein the second data component in the first data packet corresponds to the t-th time point or a historical time point before the t-th time point;
in response to determining that a host fails to receive a historical data component corresponding to the historical time point from the client device and a new data component belonging to the second data type is generated at the t-th time point, determining which of the historical data component and the new data component is more suitable to be determined as the second data component;
in response to determining that the new data component is more suitable to be determined as the second data component, determining the new data component as the second data component;
in response to determining that the historical data component is more suitable to be determined as the second data component, determining the historical data component as the second data component; and
sending, by the client device, a first data packet to the host at the t-th time point, wherein the first data packet comprises a first payload, and the first payload comprises the first data component and the second data component, wherein the first payload of the first data packet at the t-th time point and other first payloads respectively corresponding to other first data packets at the other time points have the same size.
2 . The method according to claim 1 , wherein the first data type comprises a pose data type, and the second data type comprises a control event type.
3 . The method according to claim 1 , wherein determining which of the historical data component and the new data component is more suitable to be determined as the second data component comprises:
determining a remaining size in the first payload after including the first data component into the first payload;
in response to determining that a size of only one of the historical data component and the new data component is smaller than the remaining size, determining the one of the historical data component and the new data component is more suitable to be determined as the second data component;
in response to determining that both of the historical data component and the new data component is smaller than the remaining size, determining the new data component is more suitable to be determined as the second data component.
4 . The method according to claim 1 , wherein the client device is a handheld controller for a reality service.
5 . A client device, comprising:
a non-transitory storage circuit, storing a program code; and
a processor, coupled to the non-transitory storage circuit and accessing the program code to perform:
determining a first data component corresponding to a t-th time point and a second data component, wherein the first data component belongs to a first data type, and the second data component belongs to the first data type or a second data type, and t is an index, wherein the first data component corresponding to the t-th time point and other first data components respectively belonging to the first data type and corresponding to other time points have a same size, wherein the second data component in the first data packet corresponds to the t-th time point or a historical time point before the t-th time point;
in response to determining that a host fails to receive a historical data component corresponding to the historical time point from the client device and a new data component belonging to the second data type is generated at the t-th time point, determining which of the historical data component and the new data component is more suitable to be determined as the second data component;
in response to determining that the new data component is more suitable to be determined as the second data component, determining the new data component as the second data component;
in response to determining that the historical data component is more suitable to be determined as the second data component, determining the historical data component as the second data component; and
sending a first data packet to the host at the t-th time point, wherein the first data packet comprises a first payload, and the first payload comprises the first data component and the second data component, wherein the first payload of the first data packet at the t-th time point and other first payloads respectively corresponding to other first data packets at the other time points have the same size.
6 . The client device according to claim 5 , wherein the first data type comprises a pose data type, and the second data type comprises a control event type.
7 . The client device according to claim 5 , wherein the processor performs:
determining a remaining size in the first payload after including the first data component into the first payload;
in response to determining that a size of only one of the historical data component and the new data component is smaller than the remaining size, determining the one of the historical data component and the new data component is more suitable to be determined as the second data component;
in response to determining that both of the historical data component and the new data component is smaller than the remaining size, determining the new data component is more suitable to be determined as the second data component.
8 . A non-transitory computer readable storage medium, the computer readable storage medium recording an executable computer program, the executable computer program being loaded by a client device to perform steps of:
determining a first data component corresponding to a t-th time point and a second data component, wherein the first data component belongs to a first data type, and the second data component belongs to the first data type or a second data type, and t is an index, wherein the first data component corresponding to the t-th time point and other first data components respectively belonging to the first data type and corresponding to other time points have a same size, wherein the second data component in the first data packet corresponds to the t-th time point or a historical time point before the t-th time point;
in response to determining that a host fails to receive a historical data component corresponding to the historical time point from the client device and a new data component belonging to the second data type is generated at the t-th time point, determining which of the historical data component and the new data component is more suitable to be determined as the second data component;
in response to determining that the new data component is more suitable to be determined as the second data component, determining the new data component as the second data component;
in response to determining that the historical data component is more suitable to be determined as the second data component, determining the historical data component as the second data component; and
sending a first data packet to the host at the t-th time point, wherein the first data packet comprises a first payload, and the first payload comprises the first data component and the second data component, wherein the first payload of the first data packet at the t-th time point and other first payloads respectively corresponding to other first data packets at the other time points have the same size.