summaryrefslogtreecommitdiffstats
path: root/tinyMEDIA
diff options
context:
space:
mode:
authorMamadou DIOP <bossiel@yahoo.fr>2016-03-10 01:31:45 +0100
committerMamadou DIOP <bossiel@yahoo.fr>2016-03-10 01:31:45 +0100
commitdf8878af00e9758ef51c4ed945a74da88f7a1c19 (patch)
tree8e7c5d9c6ad07d56b8930d960fb8894fb0b00386 /tinyMEDIA
parentad05fdc30bb422baf01740ac3ac8a97beb2b6a03 (diff)
downloaddoubango-df8878af00e9758ef51c4ed945a74da88f7a1c19.zip
doubango-df8878af00e9758ef51c4ed945a74da88f7a1c19.tar.gz
Add support for resolution change based on network congestion (enabled on 'tch' build only)
Diffstat (limited to 'tinyMEDIA')
-rwxr-xr-xtinyMEDIA/include/tinymedia/tmedia_common.h1
-rwxr-xr-xtinyMEDIA/src/tmedia_common.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/tinyMEDIA/include/tinymedia/tmedia_common.h b/tinyMEDIA/include/tinymedia/tmedia_common.h
index e786146..5fc041e 100755
--- a/tinyMEDIA/include/tinymedia/tmedia_common.h
+++ b/tinyMEDIA/include/tinymedia/tmedia_common.h
@@ -263,6 +263,7 @@ TINYMEDIA_API int tmedia_get_video_quality(tmedia_bandwidth_level_t bl);
TINYMEDIA_API int32_t tmedia_get_video_bandwidth_kbps(unsigned width, unsigned height, unsigned fps, unsigned motion_rank);
TINYMEDIA_API int32_t tmedia_get_video_bandwidth_kbps_2(unsigned width, unsigned height, unsigned fps);
TINYMEDIA_API int32_t tmedia_get_video_bandwidth_kbps_3();
+TINYMEDIA_API int32_t tmedia_get_video_motion_rank(unsigned width, unsigned height, unsigned fps, int32_t bw_kbps);
#define tmedia_get_video_qscale tmedia_get_video_quality
TMEDIA_END_DECLS
diff --git a/tinyMEDIA/src/tmedia_common.c b/tinyMEDIA/src/tmedia_common.c
index 86832e1..1f20845 100755
--- a/tinyMEDIA/src/tmedia_common.c
+++ b/tinyMEDIA/src/tmedia_common.c
@@ -451,4 +451,16 @@ int32_t tmedia_get_video_bandwidth_kbps_3()
unsigned height = 2160;
tmedia_video_get_size(tmedia_defaults_get_pref_video_size(), &width, &height);
return tmedia_get_video_bandwidth_kbps(width, height, tmedia_defaults_get_video_fps(), tmedia_defaults_get_video_motion_rank());
+}
+
+int32_t tmedia_get_video_motion_rank(unsigned width, unsigned height, unsigned fps, int32_t bw_kbps)
+{
+ if (!width || !height || !fps || bw_kbps <= 0) {
+ TSK_DEBUG_ERROR("Invalid parameter");
+ return 0;
+ }
+ else {
+ float mr = (bw_kbps * 1024.f) / (width * height * fps * 0.07f);
+ return (int32_t)(TSK_MAX(1.f, (mr + 0.5f)));
+ }
} \ No newline at end of file
OpenPOWER on IntegriCloud