summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/include/pjmedia/mp3_port.h14
-rw-r--r--pjmedia/src/pjmedia/mp3_writer.c6
2 files changed, 14 insertions, 6 deletions
diff --git a/pjmedia/include/pjmedia/mp3_port.h b/pjmedia/include/pjmedia/mp3_port.h
index 4d980b9c..279ab1ab 100644
--- a/pjmedia/include/pjmedia/mp3_port.h
+++ b/pjmedia/include/pjmedia/mp3_port.h
@@ -59,13 +59,21 @@ PJ_BEGIN_DECL
*/
typedef struct pjmedia_mp3_encoder_option
{
- /** Specify whether variable bit rate should be used (say Yes!). */
+ /** Specify whether variable bit rate should be used. Variable bitrate
+ * would normally produce better quality at the expense of probably
+ * larger file.
+ */
pj_bool_t vbr;
- /** Target bitrate, in bps. If zero, bitrate will be calculated. */
+ /** 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.
+ */
unsigned bit_rate;
- /** Encoding quality, 0-9, with 0 is the highest. */
+ /** Encoding quality, 0-9, with 0 is the highest quality. For VBR, the
+ * quality setting will only take effect when bit_rate setting is zero.
+ */
unsigned quality;
} pjmedia_mp3_encoder_option;
diff --git a/pjmedia/src/pjmedia/mp3_writer.c b/pjmedia/src/pjmedia/mp3_writer.c
index 5506f52b..74098ff4 100644
--- a/pjmedia/src/pjmedia/mp3_writer.c
+++ b/pjmedia/src/pjmedia/mp3_writer.c
@@ -199,7 +199,7 @@ static pj_status_t init_mp3_encoder(struct mp3_file_port *fport,
} else {
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.dwVbrAbr_bps = fport->mp3_option.bit_rate;
LConfig.format.LHV1.bEnableVBR = 1;
}
@@ -294,8 +294,8 @@ pjmedia_mp3_writer_port_create( pj_pool_t *pool,
fport->mp3_option.vbr = PJ_TRUE;
}
- /* Calculate bitrate if it's not specified */
- if (fport->mp3_option.bit_rate == 0)
+ /* Calculate bitrate if it's not specified, only if it's not VBR. */
+ if (fport->mp3_option.bit_rate == 0 && !fport->mp3_option.vbr)
fport->mp3_option.bit_rate = sampling_rate * channel_count;
/* Set default quality if it's not specified */