Add two missing function in libvpx config.
Also correct the copy and paste error in the encoder app.

Change-Id: I1f9b3f505541735ed8a9be368af0b6ebdad4839c
diff --git a/JNI/com/google/libvpx/LibVpxEncConfig.java b/JNI/com/google/libvpx/LibVpxEncConfig.java
index 036781b..3c878c5 100644
--- a/JNI/com/google/libvpx/LibVpxEncConfig.java
+++ b/JNI/com/google/libvpx/LibVpxEncConfig.java
@@ -187,6 +187,14 @@
     vpxCodecEncSetRCBufOptimalSz(encCfgObj, value);
   }
 
+  public void setKFMinDist(int value) {
+    vpxCodecEncSetKFMinDist(encCfgObj, value);
+  }
+
+  public void setKFMaxDist(int value) {
+    vpxCodecEncSetKFMaxDist(encCfgObj, value);
+  }
+
   public int getThreads() {
     return vpxCodecEncGetThreads(encCfgObj);
   }
diff --git a/JNI/examples/bindingEncodeExample/.classpath b/JNI/examples/bindingEncodeExample/.classpath
index a4763d1..3f9691c 100644
--- a/JNI/examples/bindingEncodeExample/.classpath
+++ b/JNI/examples/bindingEncodeExample/.classpath
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="gen"/>
 	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
 	<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="gen"/>
 	<classpathentry kind="output" path="bin/classes"/>
 </classpath>
diff --git a/JNI/examples/bindingEncodeExample/src/com/example/bindingEncodeExample/MainActivity.java b/JNI/examples/bindingEncodeExample/src/com/example/bindingEncodeExample/MainActivity.java
index 019554b..c6f8e53 100644
--- a/JNI/examples/bindingEncodeExample/src/com/example/bindingEncodeExample/MainActivity.java
+++ b/JNI/examples/bindingEncodeExample/src/com/example/bindingEncodeExample/MainActivity.java
@@ -23,6 +23,7 @@
 import com.google.libvorbis.VorbisException;
 import com.google.libvpx.LibVpxEnc;
 import com.google.libvpx.LibVpxEncConfig;
+import com.google.libvpx.LibVpxException;
 import com.google.libvpx.Rational;
 import com.google.libvpx.VpxCodecCxPkt;
 import com.google.libwebm.mkvmuxer.AudioTrack;
@@ -295,7 +296,6 @@
 
                 vpxConfig = new LibVpxEncConfig(
                         y4mReader.getWidth(), y4mReader.getHeight());
-                vpxEncoder = new LibVpxEnc(vpxConfig);
 
                 // libwebm expects nanosecond units
                 vpxConfig.setTimebase(1, 1000000000);
@@ -305,9 +305,16 @@
                 vpxConfig.setRCTargetBitrate(VideoEncoderSetting.mTargetBitrate);
                 vpxConfig.setRCMinQuantizer(VideoEncoderSetting.mMinQuantizer);
                 vpxConfig.setRCMaxQuantizer(VideoEncoderSetting.mMaxQuantizer);
-                vpxConfig.setRCTargetBitrate(VideoEncoderSetting.mKfMinDist);
-                vpxConfig.setRCTargetBitrate(VideoEncoderSetting.mKfMaxDist);
-                vpxConfig.setRCTargetBitrate(VideoEncoderSetting.mCpuUsed);
+                vpxConfig.setKFMinDist(VideoEncoderSetting.mKfMinDist);
+                vpxConfig.setKFMaxDist(VideoEncoderSetting.mKfMaxDist);
+
+                try {
+                  vpxEncoder = new LibVpxEnc(vpxConfig);
+                } catch (LibVpxException e) {
+                  error.append("Fail to create VPX encoder");
+                  return error.toString();
+                }
+                vpxEncoder.setCpuUsed(VideoEncoderSetting.mCpuUsed);
 
                 Rational timeBase = vpxConfig.getTimebase();
                 Rational timeMultiplier = timeBase.multiply(y4mReader.getFrameRate()).reciprocal();