Skip to content

Commit c68afd0

Browse files
author
zengxuhong
committed
bump version to 3.1.0.2
1 parent 27f353f commit c68afd0

31 files changed

+123
-44
lines changed

demo/demo.iml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
1313
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
1414
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
15-
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
16-
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
1715
<afterSyncTasks>
18-
<task>generateDebugAndroidTestSources</task>
1916
<task>generateDebugSources</task>
2017
</afterSyncTasks>
2118
<option name="ALLOW_USER_CONFIGURATION" value="false" />
@@ -25,7 +22,7 @@
2522
</component>
2623
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
2724
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
28-
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
25+
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
2926
<exclude-output />
3027
<content url="file://$MODULE_DIR$">
3128
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
@@ -47,6 +44,13 @@
4744
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/java" isTestSource="false" />
4845
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/jni" isTestSource="false" />
4946
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/rs" isTestSource="false" />
47+
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
48+
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
49+
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
50+
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
51+
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
52+
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
53+
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
5054
<sourceFolder url="file://$MODULE_DIR$/res" type="java-resource" />
5155
<sourceFolder url="file://$MODULE_DIR$/src" type="java-resource" />
5256
<sourceFolder url="file://$MODULE_DIR$/assets" type="java-resource" />
@@ -59,25 +63,28 @@
5963
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
6064
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
6165
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
66+
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
67+
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
68+
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
69+
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
70+
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
71+
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
72+
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
6273
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
63-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
64-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
65-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
66-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
6774
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
6875
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
69-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
76+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/mockable-android-21.jar" />
7077
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
7178
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
7279
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
7380
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
74-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
7581
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
7682
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
7783
</content>
7884
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
7985
<orderEntry type="sourceFolder" forTests="false" />
8086
<orderEntry type="library" exported="" name="libksystat" level="project" />
8187
<orderEntry type="library" exported="" name="ksylive3.0" level="project" />
88+
<orderEntry type="library" exported="" scope="TEST" name="mockable-android-21" level="project" />
8289
</component>
8390
</module>
13.3 KB
Binary file not shown.

demo/libs/arm64-v8a/libksystreamer.so

4.95 MB
Binary file not shown.

demo/libs/arm64-v8a/libksyyuv.so

370 KB
Binary file not shown.

demo/libs/arm64-v8a/libreverb.so

13.4 KB
Binary file not shown.
1.39 MB
Binary file not shown.

demo/libs/armeabi-v7a/liblame.so

-225 KB
Binary file not shown.

demo/libs/ksylive3.0.jar

1.74 KB
Binary file not shown.

demo/libs/libksystat.jar

6.71 KB
Binary file not shown.

demo/libs/x86/libDenoise_export.so

21.1 KB
Binary file not shown.

demo/libs/x86/libksystreamer.so

5.27 MB
Binary file not shown.

demo/libs/x86/libksyyuv.so

446 KB
Binary file not shown.

demo/libs/x86/libreverb.so

13 KB
Binary file not shown.

demo/res/layout/camera_activity.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@
2828
android:textColor="@color/font_color_35"
2929
android:textSize="@dimen/font_size_38px" />
3030

31+
<TextView
32+
android:id="@+id/debuginfo"
33+
android:layout_width="match_parent"
34+
android:layout_height="wrap_content"
35+
android:layout_below="@id/url"
36+
android:gravity="left"
37+
android:textColor="@color/font_color_41"
38+
android:textSize="@dimen/font_size_22px" />
39+
3140
<include
3241
android:id="@+id/bar_bottom"
3342
android:layout_width="match_parent"

demo/res/layout/camera_bottombar.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
android:layout_marginLeft="20dp"
4949
android:layout_weight="1"
5050
android:background="#11123456"
51-
android:checked="false"
51+
android:checked="true"
5252
android:text="@string/beauty_switcher"
5353
android:textColor="@color/font_color_35"
5454
android:textSize="@dimen/font_size_38px"></CheckBox>

demo/res/layout/demo_activity.xml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
<RelativeLayout
99
android:id="@+id/main"
1010
android:layout_width="match_parent"
11-
android:layout_height="match_parent">
11+
android:layout_height="match_parent"
12+
android:focusable="true"
13+
android:focusableInTouchMode="true">
1214

1315
<TextView
1416
android:id="@+id/rtmpTxt"
@@ -23,27 +25,35 @@
2325
android:layout_width="match_parent"
2426
android:layout_height="wrap_content"
2527
android:layout_below="@id/rtmpTxt"
26-
android:text="rtmp://test.uplive.ksyun.com/live/androidtest" />
28+
android:text="rtmp://test.uplive.ks-cdn.com/live/androidtest" />
29+
30+
<Button
31+
android:id="@+id/connectBT"
32+
android:layout_width="match_parent"
33+
android:layout_height="wrap_content"
34+
android:layout_marginTop="10dp"
35+
android:layout_below="@id/rtmpUrl"
36+
android:text="准备直播" />
2737

2838
<RadioGroup
2939
android:id="@+id/resolution_group"
3040
android:layout_width="wrap_content"
3141
android:layout_height="wrap_content"
32-
android:layout_below="@id/rtmpUrl"
42+
android:layout_below="@id/connectBT"
3343
android:orientation="horizontal">
3444

3545
<RadioButton
3646
android:id="@+id/radiobutton1"
3747
android:layout_width="wrap_content"
3848
android:layout_height="wrap_content"
39-
android:checked="false"
49+
android:checked="true"
4050
android:text="360P" />
4151

4252
<RadioButton
4353
android:id="@+id/radiobutton2"
4454
android:layout_width="wrap_content"
4555
android:layout_height="wrap_content"
46-
android:checked="true"
56+
android:checked="false"
4757
android:text="480P" />
4858

4959
<RadioButton
@@ -149,20 +159,27 @@
149159
android:layout_width="wrap_content"
150160
android:layout_height="wrap_content"
151161
android:checked="false"
152-
android:text="初始化完成后启动推流(软编有效)" />
162+
android:text="初始化完成后启动推流" />
153163

154164
<CheckBox
155165
android:id="@+id/testsw"
156166
android:layout_width="wrap_content"
157167
android:layout_height="wrap_content"
158168
android:checked="false"
159169
android:text="测试软编预处理(填充UV分量)" />
170+
160171
<CheckBox
161172
android:id="@+id/manual_focus"
162173
android:layout_width="wrap_content"
163174
android:layout_height="wrap_content"
164175
android:checked="false"
165176
android:text="手动指定对焦测光区" />
177+
<CheckBox
178+
android:id="@+id/print_debug_info"
179+
android:layout_width="wrap_content"
180+
android:layout_height="wrap_content"
181+
android:checked="false"
182+
android:text="显示调试信息" />
166183
</LinearLayout>
167184

168185
<LinearLayout
@@ -194,7 +211,7 @@
194211
<TextView
195212
android:layout_width="wrap_content"
196213
android:layout_height="wrap_content"
197-
android:text="视频码率"
214+
android:text="视频码率(Max)"
198215
android:textSize="16sp" />
199216

200217
<EditText
@@ -221,16 +238,9 @@
221238
android:id="@+id/audioBitratePicker"
222239
android:layout_width="wrap_content"
223240
android:layout_height="wrap_content"
224-
android:text="48" />
241+
android:text="32" />
225242
</LinearLayout>
226243

227-
<Button
228-
android:id="@+id/connectBT"
229-
android:layout_width="match_parent"
230-
android:layout_height="wrap_content"
231-
android:layout_below="@id/audioBitrate"
232-
android:layout_marginTop="10dp"
233-
android:text="准备直播" />
234244

235245
</RelativeLayout>
236246
</ScrollView>

demo/src/com/ksy/recordlib/demo/CameraActivity.java

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
import java.security.MessageDigest;
3737
import java.security.NoSuchAlgorithmException;
3838
import java.util.Arrays;
39+
import java.util.Timer;
40+
import java.util.TimerTask;
3941
import java.util.concurrent.ExecutorService;
4042
import java.util.concurrent.Executors;
4143

@@ -44,6 +46,7 @@ public class CameraActivity extends Activity {
4446

4547
private static final String TAG = "CameraActivity";
4648

49+
4750
private GLSurfaceView mCameraPreview;
4851

4952
private KSYStreamer mStreamer;
@@ -62,11 +65,12 @@ public class CameraActivity extends Activity {
6265
private boolean isFlashOpened = false;
6366
private boolean startAuto = false;
6467
private boolean audio_mix = false;
65-
private String mUrl;
68+
private boolean printDebugInfo = false;
69+
private String mUrl, mDebugInfo = "";
6670
private String mBgmPath = "/sdcard/test.mp3";
6771
private static final String START_STRING = "开始直播";
6872
private static final String STOP_STRING = "停止直播";
69-
private TextView mUrlTextView;
73+
private TextView mUrlTextView, mDebugInfoTextView;
7074
private volatile boolean mAcitivityResumed = false;
7175
private KSYStreamerConfig.ENCODE_METHOD encode_method = KSYStreamerConfig.ENCODE_METHOD.SOFTWARE;
7276
public final static String URL = "url";
@@ -83,15 +87,18 @@ public class CameraActivity extends Activity {
8387
public final static String FRONT_CAMERA_MIRROR = "front_camera_mirror";
8488
public final static String TEST_SW_FILTER = "testSWFilterInterface";
8589
public final static String MANUAL_FOCUS = "manual_focus";
90+
public static final String SHOW_DEBUGINFO = "SHOW_DEBUGINFO";
8691

92+
Timer timer;
8793
ExecutorService executorService = Executors.newSingleThreadExecutor();
94+
8895
private int frameCount;
8996
private boolean testSWFilterInterface;
9097

9198
public static void startActivity(Context context, int fromType,
9299
String rtmpUrl, int frameRate, int videoBitrate, int audioBitrate,
93100
int videoResolution, boolean encodeWithHEVC, boolean isLandscape, boolean mute_audio, boolean audio_mix, boolean isFrontCameraMirror, KSYStreamerConfig.ENCODE_METHOD encodeMethod, boolean startAuto,
94-
boolean testSWFilterInterface, boolean manualFocus) {
101+
boolean testSWFilterInterface, boolean manualFocus, boolean showDebugInfo) {
95102
Intent intent = new Intent(context, CameraActivity.class);
96103
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
97104
intent.putExtra("type", fromType);
@@ -109,6 +116,7 @@ public static void startActivity(Context context, int fromType,
109116
intent.putExtra(FRONT_CAMERA_MIRROR, isFrontCameraMirror);
110117
intent.putExtra(TEST_SW_FILTER, testSWFilterInterface);
111118
intent.putExtra(MANUAL_FOCUS, manualFocus);
119+
intent.putExtra(SHOW_DEBUGINFO, showDebugInfo);
112120
context.startActivity(intent);
113121
}
114122

@@ -149,6 +157,7 @@ public void handleMessage(Message msg) {
149157
chronometer.start();
150158
mShootingText.setText(STOP_STRING);
151159
mShootingText.postInvalidate();
160+
beginInfoUploadTimer();
152161
break;
153162
case RecorderConstants.KSYVIDEO_ENCODED_FRAMES_THRESHOLD:
154163
chronometer.stop();
@@ -204,8 +213,8 @@ public void handleMessage(Message msg) {
204213
int videoBitrate = bundle.getInt(VIDEO_BITRATE, 0);
205214
if (videoBitrate > 0) {
206215
builder.setMaxAverageVideoBitrate(videoBitrate);
207-
builder.setMinAverageVideoBitrate(videoBitrate * 3 / 5);
208-
builder.setInitAverageVideoBitrate(videoBitrate * 4 / 5);
216+
builder.setMinAverageVideoBitrate(videoBitrate * 2 / 8);
217+
builder.setInitAverageVideoBitrate(videoBitrate * 5 / 8);
209218
}
210219

211220
int audioBitrate = bundle.getInt(AUDIO_BITRATE, 0);
@@ -228,9 +237,8 @@ public void handleMessage(Message msg) {
228237
builder.setSecretKeySign(skSign);
229238
builder.setTimeSecond(timeSec);
230239

231-
builder.setAudioChannels(1);
232240
builder.setSampleAudioRateInHz(44100);
233-
//builder.setEnableStreamStatModule(false);
241+
builder.setEnableStreamStatModule(true);
234242

235243
boolean landscape = bundle.getBoolean(LANDSCAPE, false);
236244
builder.setDefaultLandscape(landscape);
@@ -250,6 +258,7 @@ public void handleMessage(Message msg) {
250258
testSWFilterInterface = bundle.getBoolean(TEST_SW_FILTER, false);
251259
boolean focus_manual = bundle.getBoolean(MANUAL_FOCUS, false);
252260
builder.setManualFocus(focus_manual);
261+
printDebugInfo = bundle.getBoolean(SHOW_DEBUGINFO, false);
253262
}
254263

255264
mStreamer = new KSYStreamer(this);
@@ -258,8 +267,8 @@ public void handleMessage(Message msg) {
258267
mStreamer.setOnStatusListener(mOnErrorListener);
259268
mStreamer.setOnLogListener(mOnLogListener);
260269
mStreamer.setOnNoiseSuppressionListener(mOnNsListener);
261-
mStreamer.enableDebugLog(false);
262-
270+
mStreamer.enableDebugLog(true);
271+
mStreamer.setBeautyFilter(RecorderConstants.FILTER_BEAUTY_DENOISE);
263272
if (testSWFilterInterface) {
264273
mStreamer.setOnPreviewFrameListener(new OnPreviewFrameListener() {
265274
@Override
@@ -343,7 +352,39 @@ public void onClick(View arg0) {
343352
mFlashView.setEnabled(true);
344353

345354
chronometer = (Chronometer) this.findViewById(R.id.chronometer);
355+
mDebugInfoTextView = (TextView) this.findViewById(R.id.debuginfo);
356+
357+
358+
}
359+
360+
private void beginInfoUploadTimer() {
361+
if (printDebugInfo && timer == null) {
362+
timer = new Timer();
363+
timer.schedule(new TimerTask() {
364+
@Override
365+
public void run() {
366+
updateDebugInfo();
367+
runOnUiThread(new Runnable() {
368+
@Override
369+
public void run() {
370+
mDebugInfoTextView.setText(mDebugInfo);
371+
}
372+
});
373+
}
374+
}, 100, 3000);
375+
}
376+
}
346377

378+
private void updateDebugInfo() {
379+
if (mStreamer == null) return;
380+
mDebugInfo = String.format("RtmpHostIP()=%s DroppedFrameCount()=%d \n " +
381+
"ConnectTime()=%d DnsParseTime()=%d \n " +
382+
"UploadedKB()=%d EncodedFrames()=%d \n" +
383+
"CurrentBitrate=%f Version()=%s",
384+
mStreamer.getRtmpHostIP(), mStreamer.getDroppedFrameCount(),
385+
mStreamer.getConnectTime(), mStreamer.getDnsParseTime(),
386+
mStreamer.getUploadedKBytes(), mStreamer.getEncodedFrames(),
387+
mStreamer.getCurrentBitrate(), mStreamer.getVersion());
347388
}
348389

349390

@@ -539,6 +580,9 @@ public void onDestroy() {
539580
mHandler.removeCallbacksAndMessages(null);
540581
mHandler = null;
541582
}
583+
if (timer != null) {
584+
timer.cancel();
585+
}
542586
}
543587

544588
protected int mStopTime = 0;
@@ -628,9 +672,6 @@ public void onClick(View view) {
628672
}
629673
}
630674

631-
private void printLog() {
632-
Log.e(TAG, String.format("getRtmpHostIP()=%s getDroppedFrameCount()=%d getConnectTime()=%d getDnsParseTime()=%d ", mStreamer.getRtmpHostIP(), mStreamer.getDroppedFrameCount(), mStreamer.getConnectTime(), mStreamer.getDnsParseTime()));
633-
}
634675

635676
private String md5(String string) {
636677
byte[] hash;

0 commit comments

Comments
 (0)