summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/libvpx/vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm2
-rw-r--r--media/libvpx/vpx/src/vpx_encoder.c55
-rw-r--r--media/webrtc/signaling/src/jsep/JsepTrack.cpp29
3 files changed, 50 insertions, 36 deletions
diff --git a/media/libvpx/vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm b/media/libvpx/vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm
index 449d52b22..3ad4b00dc 100644
--- a/media/libvpx/vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm
+++ b/media/libvpx/vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm
@@ -369,7 +369,7 @@ cglobal quantize_%1, 0, %2, 15, coeff, ncoeff, skip, zbin, round, quant, \
pshuflw m7, m8, 0x1
pmaxsw m8, m7
pextrw r6, m8, 0
- mov [r2], r6
+ mov [r2], r6w
RET
; skip-block, i.e. just write all zeroes
diff --git a/media/libvpx/vpx/src/vpx_encoder.c b/media/libvpx/vpx/src/vpx_encoder.c
index cd10c411c..88b1da481 100644
--- a/media/libvpx/vpx/src/vpx_encoder.c
+++ b/media/libvpx/vpx/src/vpx_encoder.c
@@ -13,8 +13,11 @@
* \brief Provides the high level interface to wrap encoder algorithms.
*
*/
+#include <assert.h>
#include <limits.h>
+#include <stdlib.h>
#include <string.h>
+#include "vp8/common/blockd.h"
#include "vpx_config.h"
#include "vpx/internal/vpx_codec_internal.h"
@@ -89,6 +92,8 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver(vpx_codec_ctx_t *ctx,
int i;
void *mem_loc = NULL;
+ if (iface->enc.mr_get_mem_loc == NULL) return VPX_CODEC_INCAPABLE;
+
if (!(res = iface->enc.mr_get_mem_loc(cfg, &mem_loc))) {
for (i = 0; i < num_enc; i++) {
vpx_codec_priv_enc_mr_cfg_t mr_cfg;
@@ -98,28 +103,29 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver(vpx_codec_ctx_t *ctx,
dsf->den > dsf->num) {
res = VPX_CODEC_INVALID_PARAM;
break;
+ } else {
+
+ mr_cfg.mr_low_res_mode_info = mem_loc;
+ mr_cfg.mr_total_resolutions = num_enc;
+ mr_cfg.mr_encoder_id = num_enc - 1 - i;
+ mr_cfg.mr_down_sampling_factor.num = dsf->num;
+ mr_cfg.mr_down_sampling_factor.den = dsf->den;
+
+ /* Force Key-frame synchronization. Namely, encoder at higher
+ * resolution always use the same frame_type chosen by the
+ * lowest-resolution encoder.
+ */
+ if (mr_cfg.mr_encoder_id)
+ cfg->kf_mode = VPX_KF_DISABLED;
+
+ ctx->iface = iface;
+ ctx->name = iface->name;
+ ctx->priv = NULL;
+ ctx->init_flags = flags;
+ ctx->config.enc = cfg;
+ res = ctx->iface->init(ctx, &mr_cfg);
}
- mr_cfg.mr_low_res_mode_info = mem_loc;
- mr_cfg.mr_total_resolutions = num_enc;
- mr_cfg.mr_encoder_id = num_enc - 1 - i;
- mr_cfg.mr_down_sampling_factor.num = dsf->num;
- mr_cfg.mr_down_sampling_factor.den = dsf->den;
-
- /* Force Key-frame synchronization. Namely, encoder at higher
- * resolution always use the same frame_type chosen by the
- * lowest-resolution encoder.
- */
- if (mr_cfg.mr_encoder_id)
- cfg->kf_mode = VPX_KF_DISABLED;
-
- ctx->iface = iface;
- ctx->name = iface->name;
- ctx->priv = NULL;
- ctx->init_flags = flags;
- ctx->config.enc = cfg;
- res = ctx->iface->init(ctx, &mr_cfg);
-
if (res) {
const char *error_detail =
ctx->priv ? ctx->priv->err_detail : NULL;
@@ -134,11 +140,14 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver(vpx_codec_ctx_t *ctx,
vpx_codec_destroy(ctx);
i--;
}
+#if CONFIG_MULTI_RES_ENCODING
+ assert(mem_loc);
+ free(((LOWER_RES_FRAME_INFO *)mem_loc)->mb_info);
+ free(mem_loc);
+#endif
+ return SAVE_STATUS(ctx, res);
}
- if (res)
- break;
-
ctx++;
cfg++;
dsf++;
diff --git a/media/webrtc/signaling/src/jsep/JsepTrack.cpp b/media/webrtc/signaling/src/jsep/JsepTrack.cpp
index 1b045d8ec..cf5df96bf 100644
--- a/media/webrtc/signaling/src/jsep/JsepTrack.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepTrack.cpp
@@ -410,21 +410,26 @@ JsepTrack::NegotiateCodecs(
// TODO(bug 814227): Remove this once we're ready to put multiple codecs in an
// answer. For now, remove all but the first codec unless the red codec
- // exists, and then we include the others per RFC 5109, section 14.2.
- // Note: now allows keeping the telephone-event codec, if it appears, as the
- // last codec in the list.
+ // exists, in which case we include the others per RFC 5109, section 14.2.
if (!codecs->empty() && !red) {
- int newSize = dtmf ? 2 : 1;
- for (size_t i = 1; i < codecs->size(); ++i) {
- if (!dtmf || dtmf != (*codecs)[i]) {
- delete (*codecs)[i];
- (*codecs)[i] = nullptr;
+ std::vector<JsepCodecDescription*> codecsToKeep;
+
+ bool foundPreferredCodec = false;
+ for (auto codec: *codecs) {
+ if (codec == dtmf) {
+ codecsToKeep.push_back(codec);
+ // TODO: keep ulpfec when we enable it in Bug 875922
+ // } else if (codec == ulpfec) {
+ // codecsToKeep.push_back(codec);
+ } else if (!foundPreferredCodec) {
+ codecsToKeep.insert(codecsToKeep.begin(), codec);
+ foundPreferredCodec = true;
+ } else {
+ delete codec;
}
}
- if (dtmf) {
- (*codecs)[newSize-1] = dtmf;
- }
- codecs->resize(newSize);
+
+ *codecs = codecsToKeep;
}
}