Compare commits

..

8 Commits

Author SHA1 Message Date
18401019693
ee5d3bb028 送礼物更改 2022-11-22 14:52:49 +08:00
18401019693
1346a1de52 测试修改 2022-11-18 17:28:42 +08:00
18401019693
9fa0109c2e 测试更改 2022-11-18 10:50:40 +08:00
94a96ba91a 调整直播间礼物弹框高度 2022-11-18 10:40:11 +08:00
18401019693
5006b8414e 测试修改 2022-11-15 13:53:15 +08:00
18401019693
5eac127142 测试修改 2022-11-15 11:31:59 +08:00
18401019693
8e89fdfa65 测试修改 2022-11-15 10:24:37 +08:00
5f210af804 修复关闭小窗时部分机型闪退问题
修复热度加gif不播放问题
修复送礼主播会闪退问题(心愿单id冲突)
修复一处PK中的空指针问题
修复滑动直播间不显示离开图
2022-11-15 10:10:28 +08:00
5798 changed files with 65678 additions and 165428 deletions

View File

@ -1,12 +1,12 @@
apply plugin: 'com.android.library'
apply plugin: 'img-optimizer'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply from: "../package_config.gradle"
apply plugin: 'kotlin-android-extensions'
android {
namespace "com.yunbao.faceunity"
compileSdk rootProject.ext.android.compileSdkVersion
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
packagingOptions {
pickFirst "lib/armeabi/libyuvutils.so"
pickFirst "lib/arm64-v8a/libyuvutils.so"
@ -34,7 +34,6 @@ android {
manifestPlaceholders = rootProject.ext.manifestPlaceholders
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
// abiFilters "armeabi-v7a", "arm64-v8a","x86","x86_64"
}
}
aaptOptions {
@ -49,8 +48,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_18
targetCompatibility JavaVersion.VERSION_18
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
@ -59,15 +58,15 @@ repositories {
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
api rootProject.ext.dependencies["appcompat-androidx"]
api rootProject.ext.dependencies["recyclerview-androidx"]
api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies["appcompat-androidx"]
implementation rootProject.ext.dependencies["recyclerview-androidx"]
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//common
api project(path: ':common')
implementation project(path: ':common')
api 'com.faceunity:core:8.7.0'
api 'com.faceunity:model:8.7.0'
implementation 'com.faceunity:core:8.3.1'
implementation 'com.faceunity:model:8.3.1'
//implementation 'com.faceunity:nama:8.3.1' //-

View File

@ -2,7 +2,7 @@ package com.yunbao.faceunity;
import android.content.Context;
import androidx.test.platform.app.Instrimport com.yunbao.common.utils.MobclickAgent;ntationRegistry;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;

View File

@ -1,5 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
package="com.yunbao.faceunity"
>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />

View File

@ -38,6 +38,9 @@ import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.callback.IRCRTCVideoOutputFrameListener;
import cn.rongcloud.rtc.base.RCRTCVideoFrame;
/**
* 美颜模块管理类
@ -68,7 +71,7 @@ public class FaceManager implements SensorEventListener {
* 配置美颜SDK
*/
public void initFURender(Context context) {
initFaceUnity(context);
mFURenderer = FURenderer.getInstance();
mFURenderer.setInputTextureType(FUInputTextureEnum.FU_ADM_FLAG_COMMON_TEXTURE);
mFURenderer.setCameraFacing(CameraFacingEnum.CAMERA_FRONT);
@ -93,26 +96,18 @@ public class FaceManager implements SensorEventListener {
faceUnityView.setIFaceUnityInter(new FaceUnityView.IFaceUnityInter() {
@Override
public void onPause() {
if(onMirrorChanged!=null){
onMirrorChanged.onChange(false);
}
pauseFace = true;
}
@Override
public void onStart() {
if(onMirrorChanged!=null){
onMirrorChanged.onChange(true);
}
pauseFace = false;
}
});
}
public void loadConfig() {
public void loadConfig(){
initFaceBeauty();
}
public void initFaceBeauty() {
FaceBeautyDataFactory faceBeautyDataFactory;
faceBeautyDataFactory = new FaceBeautyDataFactory();
@ -120,13 +115,9 @@ public class FaceManager implements SensorEventListener {
for (String key : configMap.keySet()) {
if ("FilterViewHolder_".equals(key)) {
for (FaceBeautyFilterBean filter : faceBeautyDataFactory.getBeautyFilters()) {
if (filter.getKey().equals(configMap.get(key)) && !"origin".equals(configMap.get(key))) {
try {
faceBeautyDataFactory.onFilterSelected(filter.getKey(), Double.parseDouble((String) Objects.requireNonNull(configMap.get("FilterViewHolder_" + configMap.get(key) + "_val"))) / 100, filter.getDesRes());
Log.i(TAG, "test: 设置滤镜 =" + filter.getKey() + " val = " + configMap.get("FilterViewHolder_" + configMap.get(key) + "_val"));
} catch (Exception e) {
e.printStackTrace();
}
if (filter.getKey().equals(configMap.get(key))&&!"origin".equals(configMap.get(key))) {
faceBeautyDataFactory.onFilterSelected(filter.getKey(), Double.parseDouble((String) Objects.requireNonNull(configMap.get("FilterViewHolder_" + configMap.get(key) + "_val")))/100, filter.getDesRes());
Log.i(TAG, "test: 设置滤镜 ="+filter.getKey()+" val = "+configMap.get("FilterViewHolder_" + configMap.get(key) + "_val"));
break;
}
}
@ -134,25 +125,17 @@ public class FaceManager implements SensorEventListener {
String name = key.replace("BeautySkinViewHolder_", "");
for (FaceBeautyBean bean : faceBeautyDataFactory.getShapeBeauty()) {
if (bean.getKey().equals(name)) {
try {
faceBeautyDataFactory.updateParamIntensity(bean.getKey(), Double.parseDouble((String) Objects.requireNonNull(configMap.get(key))));
Log.i(TAG, "test: 设置美颜 = " + bean.getKey() + " val = " + configMap.get(key));
} catch (Exception e) {
e.printStackTrace();
}
faceBeautyDataFactory.updateParamIntensity(bean.getKey(),Double.parseDouble((String) Objects.requireNonNull(configMap.get(key))));
Log.i(TAG, "test: 设置美颜 = "+bean.getKey()+" val = "+configMap.get(key));
break;
}
}
} else if (key.startsWith("BeautyShapeViewHolder")) {
}else if(key.startsWith("BeautyShapeViewHolder")){
String name = key.replace("BeautyShapeViewHolder_", "");
for (FaceBeautyBean bean : faceBeautyDataFactory.getShapeBeauty()) {
if (bean.getKey().equals(name)) {
try {
faceBeautyDataFactory.updateParamIntensity(bean.getKey(), Double.parseDouble((String) Objects.requireNonNull(configMap.get(key))));
Log.i(TAG, "test: 设置美肤 = " + bean.getKey() + " val = " + configMap.get(key));
} catch (Exception e) {
e.printStackTrace();
}
faceBeautyDataFactory.updateParamIntensity(bean.getKey(),Double.parseDouble((String) Objects.requireNonNull(configMap.get(key))));
Log.i(TAG, "test: 设置美肤 = "+bean.getKey()+" val = "+configMap.get(key));
break;
}
}
@ -175,6 +158,44 @@ public class FaceManager implements SensorEventListener {
private static final int CAMERA_SWITCH_SKIP_FRAME = 0;
private volatile boolean mSkip;
/**
* 渲染融云视频帧
*/
public void drawRongFrame(Context context) {
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoFrameListener(new IRCRTCVideoOutputFrameListener() {
@Override
public RCRTCVideoFrame processVideoFrame(RCRTCVideoFrame callVideoFrame) {
//Log.i(TAG, "processVideoFrame: egl context " + EGL14.eglGetCurrentContext());
if (pauseFace) {
return callVideoFrame;
}
int width = callVideoFrame.getWidth();
int height = callVideoFrame.getHeight();
if (mIsFirstFrame) {
mIsFirstFrame = false;
//initCsvUtil(context);
mFURenderer.prepareRenderer(mFURendererListener);
}
//long start = System.nanoTime();
mFURenderer.setInputOrientation(callVideoFrame.getRotation());
FURenderOutputData data = mFURenderer.onDrawFrameInputWithReturn(callVideoFrame.getData(), width, height);
/* long time = System.nanoTime() - start;
if (mCSVUtils != null) {
mCSVUtils.writeCsv(null, time);
}*/
if (mSkippedFrames > 0 || mSkip) {
--mSkippedFrames;
return callVideoFrame;
}
if (data != null && data.getImage() != null && data.getImage().getBuffer() != null) {
callVideoFrame.setData(data.getImage().getBuffer());
}
return callVideoFrame;
}
});
}
/**
* 记录渲染工具调试用在processVideoFrame里使用
@ -237,6 +258,12 @@ public class FaceManager implements SensorEventListener {
}
/**
* 离开渲染界面时注销融云监听器不然会绿屏
*/
public void onClose() {
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoFrameListener(null);
}
/**
* 释放资源
@ -250,22 +277,10 @@ public class FaceManager implements SensorEventListener {
} catch (Exception e) {
e.printStackTrace();
}
isInit = false;
}
OnMirrorChanged onMirrorChanged;
public void setOnMirrorChanged(OnMirrorChanged onMirrorChanged) {
this.onMirrorChanged = onMirrorChanged;
}
public interface FaceStatusChanged {
void onFaceChanged(int num);
}
public interface OnMirrorChanged{
void onChange(boolean falg);
}
}

View File

@ -80,11 +80,11 @@ public class ContainerRecyclerAdapter extends RecyclerView.Adapter<BaseViewHolde
}
public void hideSeekBar() {
if (seekBar.getVisibility() == View.INVISIBLE) {
if (seekBar.getVisibility() == View.GONE) {
return;
}
seekBar.setOnProgressChangeListener(null);
seekBar.setVisibility(View.INVISIBLE);
seekBar.setVisibility(View.GONE);
}

View File

@ -52,11 +52,11 @@ public class FURenderer extends IFURenderer {
/* 特效FURenderKit*/
public FURenderKit mFURenderKit;
private FURenderKit mFURenderKit;
/* AI道具*/
public static String BUNDLE_AI_FACE = "model" + File.separator + "ai_face_processor.bundle";
public static String BUNDLE_AI_HUMAN = "model" + File.separator + "ai_human_processor.bundle";
private String BUNDLE_AI_FACE = "model" + File.separator + "ai_face_processor_lite.bundle";
private String BUNDLE_AI_HUMAN = "model" + File.separator + "ai_human_processor.bundle";
/* GL 线程 ID */
private Long mGlThreadId = 0L;

View File

@ -15,7 +15,7 @@ public class FaceUnityConfig {
/************************** 算法Model ******************************/
// 人脸识别
public static String BUNDLE_AI_FACE = "model" + File.separator + "ai_face_processor.bundle";
public static String BUNDLE_AI_FACE = "model" + File.separator + "ai_face_processor_lite.bundle";
// 手势
public static String BUNDLE_AI_HAND = "model" + File.separator + "ai_hand_processor.bundle";

View File

@ -314,35 +314,6 @@ public class FileUtils {
return null;
}
public static String copyAssetsFile(Context context, String assetsPath, String fileName, String saveFileDir) {
File fileDir = new File(saveFileDir);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
File file = new File(fileDir, fileName);
if (file.exists()) {
return file.getAbsolutePath();
}
try {
InputStream inputStream = context.getAssets().open(assetsPath);
FileOutputStream fos = new FileOutputStream(file);
BufferedInputStream bis = new BufferedInputStream(inputStream);
BufferedOutputStream bos = new BufferedOutputStream(fos);
byte[] byteArray = new byte[1024];
int bytes = bis.read(byteArray);
while (bytes > 0) {
bos.write(byteArray, 0, bytes);
bos.flush();
bytes = bis.read(byteArray);
}
bos.close();
fos.close();
return file.getAbsolutePath();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
/**
* 获取Uri文件绝对路径
@ -551,7 +522,6 @@ public class FileUtils {
/**
* 遍历一个文件夹获取改文件夹下所有文件名
*
* @param path
* @return
*/
@ -593,7 +563,7 @@ public class FileUtils {
* @param path String
* @return Boolean
*/
public static Boolean checkIsVideo(Context context, String path) {
public static Boolean checkIsVideo(Context context,String path) {
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
retriever.setDataSource(context, Uri.fromFile(new File(path)));

View File

@ -1,11 +1,10 @@
package com.yunbao.common.utils;
package com.yunbao.faceunity.utils;
import android.util.Log;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@ -152,36 +151,16 @@ public class ZipUtils {
* @param zipFileString 解压完成的Zip路径
* @throws Exception
*/
public static void zipFolder(List<String> srcFileString, String zipFileString, List<String> filters, Runnable runnable) throws Exception {
if (filters == null) {
filters = new ArrayList<>();
}
filters.add(new File(zipFileString).getAbsolutePath());
final List<String> tmp = new ArrayList<>(filters);
public static void zipFolder(String srcFileString, String zipFileString) throws Exception {
//创建ZIP
ZipOutputStream outZip = new ZipOutputStream(new FileOutputStream(zipFileString));
new Thread(new Runnable() {
@Override
public void run() {
try {
for (String src : srcFileString) {
File file = new File(src);
//压缩
zipFiles(file.getParent() + File.separator, file.getName(), outZip, tmp);
}
//创建文件
//完成和关闭
outZip.finish();
outZip.close();
runnable.run();
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
//创建文件
File file = new File(srcFileString);
//压缩
zipFiles(file.getParent() + File.separator, file.getName(), outZip);
//完成和关闭
outZip.finish();
outZip.close();
}
/**
@ -192,15 +171,9 @@ public class ZipUtils {
* @param zipOutputSteam
* @throws Exception
*/
private static void zipFiles(String folderString, String fileString, ZipOutputStream zipOutputSteam, List<String> filters) throws Exception {
private static void zipFiles(String folderString, String fileString, ZipOutputStream zipOutputSteam) throws Exception {
if (zipOutputSteam == null)
return;
for (String filter : filters) {
if (fileString.startsWith(filter)) {
return;
}
}
System.out.println("压缩文件:" + folderString + "|" + fileString);
File file = new File(folderString + fileString);
if (file.isFile()) {
ZipEntry zipEntry = new ZipEntry(fileString);
@ -223,7 +196,7 @@ public class ZipUtils {
}
//子文件和递归
for (int i = 0; i < fileList.length; i++) {
zipFiles(folderString, fileString + File.separator + fileList[i], zipOutputSteam, filters);
zipFiles(folderString, fileString + File.separator + fileList[i], zipOutputSteam);
}
}
}

View File

@ -13,7 +13,7 @@ import com.google.gson.JsonObject;
import com.yunbao.faceunity.entity.net.FineStickerEntity;
import com.yunbao.faceunity.utils.FaceUnityData;
import com.yunbao.faceunity.utils.FileUtils;
import com.yunbao.common.utils.ZipUtils;
import com.yunbao.faceunity.utils.ZipUtils;
import java.io.File;
import java.util.ArrayList;

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Some files were not shown because too many files have changed in this diff Show More