Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -65,6 +65,7 @@ struct SystemCodecInfo ...@@ -65,6 +65,7 @@ struct SystemCodecInfo
static constexpr unsigned DEFAULT_H264_MAX_QUALITY {25}; static constexpr unsigned DEFAULT_H264_MAX_QUALITY {25};
static constexpr unsigned DEFAULT_VP8_MIN_QUALITY {50}; static constexpr unsigned DEFAULT_VP8_MIN_QUALITY {50};
static constexpr unsigned DEFAULT_VP8_MAX_QUALITY {20}; static constexpr unsigned DEFAULT_VP8_MAX_QUALITY {20};
static constexpr unsigned DEFAULT_VIDEO_BITRATE {250}; // in Kbits/second
#endif #endif
// indicates that the codec does not use quality factor // indicates that the codec does not use quality factor
......
...@@ -31,8 +31,6 @@ namespace ring { ...@@ -31,8 +31,6 @@ namespace ring {
decltype(getGlobalInstance<SystemCodecContainer>)& getSystemCodecContainer = getGlobalInstance<SystemCodecContainer>; decltype(getGlobalInstance<SystemCodecContainer>)& getSystemCodecContainer = getGlobalInstance<SystemCodecContainer>;
constexpr static auto DEFAULT_VIDEO_BITRATE = 250; // in Kbits/second
SystemCodecContainer::SystemCodecContainer() SystemCodecContainer::SystemCodecContainer()
{ {
initCodecConfig(); initCodecConfig();
...@@ -51,6 +49,7 @@ SystemCodecContainer::initCodecConfig() ...@@ -51,6 +49,7 @@ SystemCodecContainer::initCodecConfig()
auto maxH264 = SystemCodecInfo::DEFAULT_H264_MAX_QUALITY; auto maxH264 = SystemCodecInfo::DEFAULT_H264_MAX_QUALITY;
auto minVP8 = SystemCodecInfo::DEFAULT_VP8_MIN_QUALITY; auto minVP8 = SystemCodecInfo::DEFAULT_VP8_MIN_QUALITY;
auto maxVP8 = SystemCodecInfo::DEFAULT_VP8_MAX_QUALITY; auto maxVP8 = SystemCodecInfo::DEFAULT_VP8_MAX_QUALITY;
auto defaultBitrate = SystemCodecInfo::DEFAULT_VIDEO_BITRATE;
#endif #endif
availableCodecList_ = { availableCodecList_ = {
#ifdef RING_VIDEO #ifdef RING_VIDEO
...@@ -58,26 +57,26 @@ SystemCodecContainer::initCodecConfig() ...@@ -58,26 +57,26 @@ SystemCodecContainer::initCodecConfig()
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H264, std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H264,
"H264", "libx264", "H264", "libx264",
CODEC_ENCODER_DECODER, CODEC_ENCODER_DECODER,
DEFAULT_VIDEO_BITRATE, defaultBitrate,
minH264, minH264,
maxH264), maxH264),
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_VP8, std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_VP8,
"VP8", "libvpx", "VP8", "libvpx",
CODEC_ENCODER_DECODER, CODEC_ENCODER_DECODER,
DEFAULT_VIDEO_BITRATE, defaultBitrate,
minVP8, minVP8,
maxVP8), maxVP8),
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_MPEG4, std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_MPEG4,
"MP4V-ES", "mpeg4", "MP4V-ES", "mpeg4",
CODEC_ENCODER_DECODER, CODEC_ENCODER_DECODER,
DEFAULT_VIDEO_BITRATE), defaultBitrate),
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H263, std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H263,
"H263-1998", "h263", "H263-1998", "h263",
CODEC_ENCODER_DECODER, CODEC_ENCODER_DECODER,
DEFAULT_VIDEO_BITRATE), defaultBitrate),
#endif #endif
/* Define supported audio codec*/ /* Define supported audio codec*/
......
...@@ -193,6 +193,13 @@ void VideoRtpSession::stop() ...@@ -193,6 +193,13 @@ void VideoRtpSession::stop()
if (socketPair_) if (socketPair_)
socketPair_->interrupt(); 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(); receiveThread_.reset();
sender_.reset(); sender_.reset();
socketPair_.reset(); socketPair_.reset();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment