Commit 87f3f337 authored by Eloi Bail's avatar Eloi Bail Committed by Eloi Bail
Browse files

media/video: reuse default quality parameters

When several calls were performed, quality and bitrates of previous
call were used. When stopping VideoRtpSession, we make sure to reset default
values.

Change-Id: Ibe7b58f33979fae734dbbe3f7c31bd4d57c5a13f
Tuleap: #156
parent a6fc06b6
......@@ -65,6 +65,7 @@ struct SystemCodecInfo
static constexpr unsigned DEFAULT_H264_MAX_QUALITY {25};
static constexpr unsigned DEFAULT_VP8_MIN_QUALITY {50};
static constexpr unsigned DEFAULT_VP8_MAX_QUALITY {20};
static constexpr unsigned DEFAULT_VIDEO_BITRATE {250}; // in Kbits/second
#endif
// indicates that the codec does not use quality factor
......
......@@ -31,8 +31,6 @@ namespace ring {
decltype(getGlobalInstance<SystemCodecContainer>)& getSystemCodecContainer = getGlobalInstance<SystemCodecContainer>;
constexpr static auto DEFAULT_VIDEO_BITRATE = 250; // in Kbits/second
SystemCodecContainer::SystemCodecContainer()
{
initCodecConfig();
......@@ -51,6 +49,7 @@ SystemCodecContainer::initCodecConfig()
auto maxH264 = SystemCodecInfo::DEFAULT_H264_MAX_QUALITY;
auto minVP8 = SystemCodecInfo::DEFAULT_VP8_MIN_QUALITY;
auto maxVP8 = SystemCodecInfo::DEFAULT_VP8_MAX_QUALITY;
auto defaultBitrate = SystemCodecInfo::DEFAULT_VIDEO_BITRATE;
#endif
availableCodecList_ = {
#ifdef RING_VIDEO
......@@ -58,26 +57,26 @@ SystemCodecContainer::initCodecConfig()
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H264,
"H264", "libx264",
CODEC_ENCODER_DECODER,
DEFAULT_VIDEO_BITRATE,
defaultBitrate,
minH264,
maxH264),
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_VP8,
"VP8", "libvpx",
CODEC_ENCODER_DECODER,
DEFAULT_VIDEO_BITRATE,
defaultBitrate,
minVP8,
maxVP8),
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_MPEG4,
"MP4V-ES", "mpeg4",
CODEC_ENCODER_DECODER,
DEFAULT_VIDEO_BITRATE),
defaultBitrate),
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H263,
"H263-1998", "h263",
CODEC_ENCODER_DECODER,
DEFAULT_VIDEO_BITRATE),
defaultBitrate),
#endif
/* Define supported audio codec*/
......
......@@ -193,6 +193,13 @@ void VideoRtpSession::stop()
if (socketPair_)
socketPair_->interrupt();
// reset default video quality if exist
if (videoBitrateInfo_.videoQualityCurrent != SystemCodecInfo::DEFAULT_NO_QUALITY)
videoBitrateInfo_.videoQualityCurrent = SystemCodecInfo::DEFAULT_CODEC_QUALITY;
videoBitrateInfo_.videoBitrateCurrent = SystemCodecInfo::DEFAULT_VIDEO_BITRATE;
storeVideoBitrateInfo();
receiveThread_.reset();
sender_.reset();
socketPair_.reset();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment