A data transmission method, wherein the method is applied to a first terminal device, the first terminal device has first data to be transmitted on a sidelink, and the method comprises: obtaining, by the first terminal device, a specified quantity of sending times of sending a medium access control, MAC protocol data unit, PDU corresponding to the first data; and sending, by the first terminal device, the MAC PDU on the sidelink based on the specified quantity of sending times by using a transmission resource, wherein the transmission resource is any transmission resource in periodic resources of the first terminal device, wherein the sidelink is a direct wireless communication link between the first terminal device and a second terminal device; and the periodic resources of the first terminal device are resources allocated by the network device to the first terminal device or are periodically available transmission resources selected by the first terminal device; wherein there is a correspondence between the specified quantity of sending times and a quality of service parameter, and the obtaining, by the first terminal device, a specified quantity of sending times of sending a MAC PDU corresponding to the first data comprises: determining, by the first terminal device, the specified quantity of sending times based on the correspondence and a quality of service parameter corresponding to the MAC PDU; and wherein the method further comprises: sending, by the first terminal device, control information to the second terminal device, wherein the control information comprises a new data indicator, NDI, a redundancy version, RV identifier, and a time-frequency resource indicator, and the time-frequency resource indicator is used to indicate a time-frequency resource location of the transmission resource. obtaining, by the first terminal device, a specified quantity of sending times of sending a medium access control, MAC protocol data unit, PDU corresponding to the first data; and sending, by the first terminal device, the MAC PDU on the sidelink based on the specified quantity of sending times by using a transmission resource, wherein the transmission resource is any transmission resource in periodic resources of the first terminal device, wherein the sidelink is a direct wireless communication link between the first terminal device and a second terminal device; and the periodic resources of the first terminal device are resources allocated by the network device to the first terminal device or are periodically available transmission resources selected by the first terminal device; wherein there is a correspondence between the specified quantity of sending times and a quality of service parameter, and the obtaining, by the first terminal device, a specified quantity of sending times of sending a MAC PDU corresponding to the first data comprises: determining, by the first terminal device, the specified quantity of sending times based on the correspondence and a quality of service parameter corresponding to the MAC PDU; and wherein the method further comprises: sending, by the first terminal device, control information to the second terminal device, wherein the control information comprises a new data indicator, NDI, a redundancy version, RV identifier, and a time-frequency resource indicator, and the time-frequency resource indicator is used to indicate a time-frequency resource location of the transmission resource. determining, by the first terminal device, the specified quantity of sending times based on the correspondence and a quality of service parameter corresponding to the MAC PDU; and wherein the method further comprises: sending, by the first terminal device, control information to the second terminal device, wherein the control information comprises a new data indicator, NDI, a redundancy version, RV identifier, and a time-frequency resource indicator, and the time-frequency resource indicator is used to indicate a time-frequency resource location of the transmission resource.