A data transmission method, comprising: obtaining time-frequency resources used to transmit first data, wherein some or all of the time-frequency resources are further used to transmit second data; obtaining a transmission parameter used to transmit the second data; determining, based on the transmission parameter, a size of a to-be-encoded data block used to encode the first data; encoding the first data based on the size of the to-be-encoded data block; and mapping a data block obtained through the encoding to the time-frequency resources; wherein the transmission parameter comprises at least one of a size of a to-be-encoded data block used to transmit the second data, a quantity of transmission time intervals TTIs used to transmit the second data, a size of each TTI, a first frequency resource used to transmit the second data in each TTI, a time-frequency resource occupied by a control channel in each TTI, and a time-frequency resource occupied by a pilot in each TTI; and wherein the determining, based on the transmission parameter, a size of a to-be-encoded data block used to encode the first data comprises: determining, based on the size of each TTI and the first frequency resource used to transmit the second data in each TTI, a size of a to-be-encoded data block corresponding to each TTI; and determining, based on the size of the to-be-encoded data block corresponding to each TTI, the size of the to-be-encoded data block used to encode the first data. obtaining time-frequency resources used to transmit first data, wherein some or all of the time-frequency resources are further used to transmit second data; obtaining a transmission parameter used to transmit the second data; determining, based on the transmission parameter, a size of a to-be-encoded data block used to encode the first data; encoding the first data based on the size of the to-be-encoded data block; and mapping a data block obtained through the encoding to the time-frequency resources; wherein the transmission parameter comprises at least one of a size of a to-be-encoded data block used to transmit the second data, a quantity of transmission time intervals TTIs used to transmit the second data, a size of each TTI, a first frequency resource used to transmit the second data in each TTI, a time-frequency resource occupied by a control channel in each TTI, and a time-frequency resource occupied by a pilot in each TTI; and wherein the determining, based on the transmission parameter, a size of a to-be-encoded data block used to encode the first data comprises: determining, based on the size of each TTI and the first frequency resource used to transmit the second data in each TTI, a size of a to-be-encoded data block corresponding to each TTI; and determining, based on the size of the to-be-encoded data block corresponding to each TTI, the size of the to-be-encoded data block used to encode the first data. determining, based on the size of each TTI and the first frequency resource used to transmit the second data in each TTI, a size of a to-be-encoded data block corresponding to each TTI; and determining, based on the size of the to-be-encoded data block corresponding to each TTI, the size of the to-be-encoded data block used to encode the first data.