Skip to content

Commit

Permalink
Merge pull request #11 from KevinHuo/dev
Browse files Browse the repository at this point in the history
release v1.0.1
  • Loading branch information
geeklok authored Aug 3, 2018
2 parents 239e0c1 + db4dd09 commit fa3c474
Show file tree
Hide file tree
Showing 10 changed files with 231 additions and 77 deletions.
6 changes: 3 additions & 3 deletions QNDroidRTCDemo/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.qiniu.droid.rtc.demo"
minSdkVersion 18
targetSdkVersion 25
versionCode 5
versionName "1.0.0"
versionCode 6
versionName "1.0.1"
buildConfigField "long", "BUILD_TIMESTAMP", System.currentTimeMillis() + "L"
}
buildTypes {
Expand All @@ -20,7 +20,7 @@ android {
}

dependencies {
compile files('libs/qndroid-rtc-1.0.0.jar')
compile files('libs/qndroid-rtc-1.0.1.jar')
compile 'com.android.support:appcompat-v7:25+'
compile 'com.squareup.okhttp3:okhttp:3.9.1'
compile 'com.bugsnag:bugsnag-android-ndk:1.+'
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,17 @@ public void onCreate(Bundle savedInstanceState) {

QNRTCSetting setting = new QNRTCSetting();
setting.setCameraID(QNRTCSetting.CAMERA_FACING_ID.FRONT)
.setHWCodecEnabled(isHwCodec)
.setScreenCaptureEnabled(isScreenCaptureEnabled)
.setVideoPreviewFormat(new QNVideoFormat(mVideoWidth, mVideoHeight, QNRTCSetting.DEFAULT_FPS))
.setVideoEncodeFormat(new QNVideoFormat(mVideoWidth, mVideoHeight, QNRTCSetting.DEFAULT_FPS));
// 当设置的最低码率,远高于弱网下的常规传输码率值时,会严重影响连麦的画面流畅度
// 故建议若非场景带宽需求限制,不设置连麦码率或者设置最低码率值不过高的效果较好
// .setAudioBitrate(100 * 1000)
// .setVideoBitrate(400 * 1000)
// .setBitrateRange(200 * 1000, 1000 * 1000)
.setHWCodecEnabled(isHwCodec)
.setScreenCaptureEnabled(isScreenCaptureEnabled)
.setVideoPreviewFormat(new QNVideoFormat(mVideoWidth, mVideoHeight, QNRTCSetting.DEFAULT_FPS))
.setVideoEncodeFormat(new QNVideoFormat(mVideoWidth, mVideoHeight, QNRTCSetting.DEFAULT_FPS));

int audioBitrate = 100 * 1000;
int videoBitrate = preferences.getInt(Config.BITRATE, 600 * 1000);
setting.setAudioBitrate(audioBitrate);
setting.setVideoBitrate(videoBitrate);
//当设置的最低码率,远高于弱网下的常规传输码率值时,会严重影响连麦的画面流畅度
setting.setBitrateRange(0, videoBitrate + audioBitrate);

mControlFragment.setArguments(intent.getExtras());
mControlFragment.setScreenCaptureEnabled(isScreenCaptureEnabled);
Expand Down Expand Up @@ -490,7 +492,7 @@ private synchronized void clearMergeStreamPos(String userId) {

private int getMergeStreamIdlePos() {
int pos = -1;
for (int i = 0; i< mMergeStreamPosition.length; i++) {
for (int i = 0; i < mMergeStreamPosition.length; i++) {
if (TextUtils.isEmpty(mMergeStreamPosition[i])) {
pos = i;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
Expand Down Expand Up @@ -85,6 +86,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
mAppIdEditText.setText(mAppId);
}

//test mode setting
LinearLayout testModeLayout = (LinearLayout) findViewById(R.id.test_mode_layout);
testModeLayout.setVisibility(isTestMode() ? View.VISIBLE : View.GONE);

String[] configurations = getResources().getStringArray(R.array.conference_configuration);
mDefaultConfiguration.addAll(Arrays.asList(configurations));

Expand Down Expand Up @@ -159,10 +164,40 @@ public void onClickSaveConfiguration(View v) {
editor.putInt(Config.HEIGHT, Config.DEFAULT_RESOLUTION[mSelectPos][1]);
editor.putInt(Config.FPS, Config.DEFAULT_FPS[mSelectPos]);

if (isTestMode()) {
saveTestMode(editor);
}
editor.apply();
finish();
}

private void saveTestMode(SharedPreferences.Editor editor) {
int testModeWidth = 0;
int testModeHigh = 0;
int testModeFPS = 0;
int testModeBitrate = 0;

EditText testModeWidthEditText = (EditText) findViewById(R.id.test_mode_width);
EditText testModeHighEditText = (EditText) findViewById(R.id.test_mode_high);
EditText testModeFPSEditText = (EditText) findViewById(R.id.test_mode_fps);
EditText testModeBitrateEditText = (EditText) findViewById(R.id.test_mode_bitrate);

try {
testModeWidth = Integer.parseInt(testModeWidthEditText.getText().toString());
testModeHigh = Integer.parseInt(testModeHighEditText.getText().toString());
testModeFPS = Integer.parseInt(testModeFPSEditText.getText().toString());
testModeBitrate = Integer.parseInt(testModeBitrateEditText.getText().toString());
} catch (NumberFormatException e) {
}

if (testModeWidth > 0 && testModeHigh > 0 && testModeFPS > 0 && testModeBitrate > 0) {
editor.putInt(Config.WIDTH, testModeWidth);
editor.putInt(Config.HEIGHT, testModeHigh);
editor.putInt(Config.FPS, testModeFPS);
editor.putInt(Config.BITRATE, testModeBitrate);
}
}

private void showPopupWindow() {
mSpinnerPopupWindow.setAdapter(mAdapter);
mSpinnerPopupWindow.setWidth(mConfigTextView.getWidth());
Expand All @@ -184,6 +219,13 @@ protected String getBuildTimeDescription() {
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA).format(BuildConfig.BUILD_TIMESTAMP);
}

private boolean isTestMode() {
if (mAppIdEditText.getText().toString().compareTo(QNAppServer.TEST_MODE_APP_ID) == 0) {
return true;
}
return false;
}

private SpinnerPopupWindow.OnSpinnerItemClickListener mOnSpinnerItemClickListener = new SpinnerPopupWindow.OnSpinnerItemClickListener() {
@Override
public void onItemClick(int pos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class Config {
public static final String FPS = "fps";
public static final String CODEC_MODE = "encodeMode";
public static final String CAPTURE_MODE = "captureMode";
public static final String BITRATE = "bitrate";

public static final int HW = 0;
public static final int SW = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class QNAppServer {
private static final String TAG = "QNAppServer";
private static final String APP_SERVER_ADDR = "https://api-demo.qnsdk.com";
public static final String APP_ID = "d8lk7l4ed";
public static final String TEST_MODE_APP_ID = "d8dre8w1p";

private static class QNAppServerHolder {
private static final QNAppServer instance = new QNAppServer();
Expand Down
Loading

0 comments on commit fa3c474

Please sign in to comment.