This page help you understand basic terms about Bluetooth codec like Bit Depth, Sampling Rate, and Bit Rate.
The Bluetooth version 1.0 was invented and released in 1999 and the first Bluetooth headsets were released in the same year but the connection wasn't that consistant and stable as we have today. This tech has been vastly improved over years, and now we have Bluetooth 5.3, which is more reliable, less-processing power and low latency.
Bluetooth is backward compatibity, it means a device supports a newer Bluetooth version can still connect with peripherals that support older Bluetooth versions. For example, my current Galaxy phone supports Bluetooth 5.3, and my 1MORE Comfobuds TWS earbuds only support Bluetooth 5.0 and they can still pair with my phone, indeed I won't get any benefit from Bluetooth 5.3. If I have Redmi Buds 4 Pro that support Bluetooth 5.3 I will get all benefits from Bluetooth 5.3 standard and codecs it supports, a note that specific codecs only work if both ends (phone and Bluetooth earbuds) support it.
Higher Bluetooth version transfers more efficient and faster as shown in table below:
How devices connect to each other over Bluetooth?
Bluetooth devices communicate with other other using low-power ratio waves on a frequency band between 2.400 GHz and 2.483.5 GHz (a.k.a 2.4 GHz ISM spectrum band) according to SIG (Bluetooth Special Interest Group). The range enables the good balance between range and data rate, since the lower frequency the lower data rate it supports.
What kind of data can transmit between devices over Bluetooth?
Type of data transmitted over Bluetooth is defined by a Bluetoth profile and there are a bunch of Bluetooth profiles, so we have many kinds of data like text, photos, voice-call, videos, music, apps, printer jobs, and more, each corresponds to a Bluetooth profile. The Advanced Audio Distribution Profile (A2DP) determines the music data transfer (high-quality stereo audio) over Bluetooth, the A2DP transfers data in one way and it's known for quality optimization over the expense of latency.
HSP (short for Hands-Free) is another Bluetooth profile for voice call, the profile is implemented in most Bluetooth headphones for calls.
Here is the list of Bluetooth profiles, Bluetooth headphones and wireless earbuds
What's exactly a Bluetooth profile?
Have you ever printed a page from your phone to your HP printer over Bluetooth - this type of data sent over Bluetooth for printer job relies on a Bluetooth profile - a wireless interface specification for Bluetooth-base communication between devices, in this case they are your phone and printer, and both have HCRP (short for Hardcopy Cable Replacement Profile) profile implementation.
The wireless interface specification can be interpreted as standards and protocols. Those standards and protocols are built on top the Bluetooth core specification, so they may be an additional protocol or use a specific feature of the Core specification. For example, in A2DP v1.4 profile, the Audio/Video Distribution Transport Protocol (AVDTP) is an additional protocol to the Core Specifiction including Baseband, Link Manager Protocol (LMP), Logical Link Control and Adaptation Protocol (L2CAP), and Service Discovery Protocol (SDP) Bluetooth protocols that are defined in the Bluetooth Core Specification. A profile like A2DP has many versions, the latest is A2DP 1.4, and it's not anchored to any specific version of Core Specifiction.

Many profiles can be grouped together to form a special set that applies to a specific stack like Bluetooth Low Energy. A profile is dependent upon another profile if it re-uses parts of that profile as illustrated below for A2DP.

As you can see in Figure 1 and 2, the the A2DP specification includes information about the the dependencies, protocols and user interface (in GAP and GAVDP is applicable for A2DP).
Here is the list of Bluetooth profiles.
What's Bluetooth Codec?
Codec stands for encode/decode or compression/decompression. A Bluetooth codec is a software with complex algorithm that compresses/encodes audio data prior to transmission over Bluetooth and decode compressed data at the output. It can be an essential part of a profile or an additional codec. For example, the SBC (short for low complexity subband Coding) is an integeral part of A2DP and both ends must support it, for example, phones as source devices implement a SBC encoder and Bluetooth headphones implement a SBC decoder. The SBC specification is also a part of the Bluetooth specification.
Behind the scenes a codec does a job for encoding the digital audio data from the source device (your phones) and decoding on the output device (on your Bluetooth headphones). The figure below illustrate how raw audio data is compressed and sent over Bluetooth using a codec, the encoded data goes through AVDTP and L2CAP protocols and then decoded at the output device. A codec here can be SBC, AAC or anything else (LDAC, AtpX, SSC, L2HC, etc.)

SIG points out three important parameters a codec (I just copied and pasted it here):
- Sample Rate (Hz): Also known as sample frequency, referring to the number of samples taken per unit of time. It captures the signal amplitude at a specific point of time. The higher the sample rate, the closer the compressed stream is to the original stream but the larger the resulting audio file size ends up being. Keep in mind that according to the Nyquist Sampling theorem, the sampling frequency to produce the exact original waveform should be double the original frequency of the signal.
- Bit Depth (bits): This refers to the number of bits of information in each sample. Common bit-depth values include 16-bit, 24-bit, and 32-bit.
- Bit Rate (kbps): This refers to the number of bits encoded per second and correlates to the audio quality of the stream. It is measured in kilobits per second. The higher the bit rate the higher quality of the stream. Good quality music has a bit rate of 96 kbps or greater.
The bit rate for an uncompressed audio stream is calculated by multiplying the sampling rate by the bit depth by the number of channels encoded (e.g. left and right audio channels):
bit rate (uncompressed stream) = sampling rate × bit depth × no. of channels
What Bluetooth Audio Codec Is The Best?
Data rate: The speed at which data is transferred within your source device (your phones) to end devices (your Bluetooth earbuds), it's measure in bytes per second.