diff options
Diffstat (limited to 'pjmedia')
-rw-r--r-- | pjmedia/include/pjmedia/mp3_port.h | 8 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/mp3_writer.c | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/pjmedia/include/pjmedia/mp3_port.h b/pjmedia/include/pjmedia/mp3_port.h index 279ab1ab..db4b3477 100644 --- a/pjmedia/include/pjmedia/mp3_port.h +++ b/pjmedia/include/pjmedia/mp3_port.h @@ -65,9 +65,11 @@ typedef struct pjmedia_mp3_encoder_option */ pj_bool_t vbr; - /** Target bitrate, in bps. For VBR, if the bitrate is specified, then - * the encoder will ignore the quality settings and instead will try to - * limit the bitrate to the desired value in this setting. + /** Target bitrate, in bps. If VBR is enabled, this settings specifies + * the average bit-rate requested, and will make the encoder ignore + * the quality setting. For CBR, this specifies the actual bitrate, + * and if this option is zero, it will be set to the sampling rate + * multiplied by number of channels. */ unsigned bit_rate; diff --git a/pjmedia/src/pjmedia/mp3_writer.c b/pjmedia/src/pjmedia/mp3_writer.c index 74098ff4..ed6646f8 100644 --- a/pjmedia/src/pjmedia/mp3_writer.c +++ b/pjmedia/src/pjmedia/mp3_writer.c @@ -200,10 +200,14 @@ static pj_status_t init_mp3_encoder(struct mp3_file_port *fport, LConfig.format.LHV1.nVbrMethod = VBR_METHOD_DEFAULT; LConfig.format.LHV1.bWriteVBRHeader = 1; LConfig.format.LHV1.dwVbrAbr_bps = fport->mp3_option.bit_rate; + LConfig.format.LHV1.nVBRQuality = (pj_uint16_t) + fport->mp3_option.quality; LConfig.format.LHV1.bEnableVBR = 1; } - LConfig.format.LHV1.nQuality = (pj_uint16_t)fport->mp3_option.quality; + LConfig.format.LHV1.nQuality = (pj_uint16_t) + (((0-fport->mp3_option.quality-1)<<8) | + fport->mp3_option.quality); /* * Init MP3 stream. |