shithub: openh264

Download patch

ref: 352f5eea7a73a16c3ed68256327a04311df585b0
parent: dacd22d695152105dc9dc93776513247a27371dc
author: Martin Storsjö <[email protected]>
date: Fri Aug 8 18:31:49 EDT 2014

Get the actual used parameters in the codec in TemporalLayerSettingTest

Make sure that pOptions is initialized to the parameters that
the codec actually uses, not the ones that we initially tried
to set.

When calling SetOption to update the codec parameters, this may
cause a reset of the whole codec if e.g. the number of threads
differs from what is set within the codec itself.

If the number of threads was changed by the codec internally
when inited (e.g. changed from 0 to 1), WelsEncoderParamAdjust
may think the whole codec needs to be reset.

This fixes running EncoderInterfaceTest.TemporalLayerSettingTest
on machines where the detected number of cores is 1.

--- a/test/encoder/EncUT_EncoderExt.cpp
+++ b/test/encoder/EncUT_EncoderExt.cpp
@@ -163,10 +163,11 @@
     EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
     EXPECT_EQ (sFbi.eFrameType, static_cast<int> (videoFrameTypeP));
 
-    memcpy (pOption, pParamExt, sizeof (SEncParamExt));
+    ENCODER_OPTION eOptionId = ENCODER_OPTION_SVC_ENCODE_PARAM_EXT;
+    iResult = pPtrEnc->GetOption (eOptionId, pOption);
+    EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
     pOption ->iTemporalLayerNum = 4;
 
-    ENCODER_OPTION eOptionId = ENCODER_OPTION_SVC_ENCODE_PARAM_EXT;
     iResult = pPtrEnc->SetOption (eOptionId, pOption);
     EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));