History

rtpdec: Interpret the different G726 names as bits_per_coded_sample

For the standardized 8 kHz sample rate, this works exactly the same. For nonstandard sample rates, the different predefined G726 names (G726-16, G726-24, G726-32, G726-40) are interpreted as an indication of the bits per coded sample, even though their actual bitrates aren't what the name specifies. This feels more sane than using free-form names for nonstandard sample rate/bitrate combinations, e.g like G726-22, G726-33 for 11025 Hz.

Martin Storsjö committed 14 years ago

Commit fa6dce41 parent 77e0c751 file · +2 −4Browse files

Unified · Split

libavformat/rtpdec_g726.c+2−4
@@ -27,10 +27,8 @@ static int g726_ ## bitrate ##_init(AVFormatContext *s, int st_index, PayloadCon · 26 unmodified lines
27 AVStream *stream = s->streams[st_index]; \27 AVStream *stream = s->streams[st_index]; \
28 AVCodecContext *codec = stream->codec; \28 AVCodecContext *codec = stream->codec; \
29\29\
30 codec->bit_rate = bitrate*1000; \30 codec->bits_per_coded_sample = bitrate/8; \
31 if (codec->sample_rate) \31 codec->bit_rate = codec->bits_per_coded_sample * codec->sample_rate; \
32 codec->bits_per_coded_sample = \
33 av_clip((codec->bit_rate + codec->sample_rate/2) / codec->sample_rate, 2, 5); \
34\32\
35 return 0; \33 return 0; \
36} \34} \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t