liuguijing 1 year ago
commit 849f5e4ebc

@ -5,7 +5,7 @@ plugins {
// 10,00,000 major-minor-build
def AppMajorVersion = 1
def AppMinorVersion = 0
def AppBuildNumber = 140
def AppBuildNumber = 141
def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber
def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber

@ -17,6 +17,8 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.Log;
@ -49,6 +51,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.concurrent.Semaphore;
public class Camera2VideoActivity extends AppCompatActivity {
@ -81,11 +84,12 @@ public class Camera2VideoActivity extends AppCompatActivity {
private int mOSDMargin = 0;
private Paint mPaint;
private Paint mPaintStroker;
private Bitmap mBitmap;
private List<Bitmap> mBitmaps = new ArrayList<>();
private GlWatermarkFilter mOSDFilter = null;
private Object mBitmapLocker = new Object();
private SimpleDateFormat mDateFormater;
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss a");
@ -94,9 +98,6 @@ public class Camera2VideoActivity extends AppCompatActivity {
private int mTimeMask = 0;
private int mStatusBarHeight = -1;
private long mOsdTs = 0;
private Semaphore mOSDSemaphore = new Semaphore(0);
private static class OSD_ITEM
{
@ -126,49 +127,75 @@ public class Camera2VideoActivity extends AppCompatActivity {
private final static int TIME_MASK_LB = TIME_MASK_LB_TS | TIME_MASK_LB_DT | TIME_MASK_LB_ML;
private Handler mHandler = null;
private Runnable mTimerRunnable = new Runnable() {
private class TimerRunner implements Runnable {
private Bitmap mBitmap;
TimerRunner(Bitmap bm) {
mBitmap = bm;
}
@Override
public void run() {
synchronized (mBitmapLocker) {
if (mBitmap != null) {
Bitmap bitmap = mBitmap;
mBitmap = null;
mOSDFilter.updateBitmap(bitmap);
Bitmap oldBm = null;
if (mBitmap != null) {
oldBm = mOSDFilter.updateBitmap(mBitmap);
}
if (oldBm != null) {
synchronized (mBitmapLocker) {
mBitmaps.add(oldBm);
}
}
long ts = System.currentTimeMillis();
mOsdTs = ts + 1000; // next second
long ms = ts % 1000;
Log.d("OSD", "Cur TS=" + Long.toString(ts / 1000) + " Timer=" + Long.toString(1000 - ms));
mOSDSemaphore.release();
mHandler.postDelayed(this, 1000 - ms);
Message msg = Message.obtain();
msg.what = 1;
msg.obj = new Long(ts - ms + 1000);
mOsdHandler.sendMessage(msg);
}
};
}
private Handler mOsdHandler;
private Thread mOsdThread = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
mOSDSemaphore.acquire();
} catch (Exception ex) {
}
if (mOsdTs == -1) {
break;
Looper.prepare();
mOsdHandler = new Handler(Looper.myLooper()) {
public void handleMessage(Message msg) {
if (msg.what == 1) {
Long targetTs = (Long)msg.obj;
long ts = System.currentTimeMillis();
if (ts > targetTs.longValue()) {
return;
}
Bitmap bm = null;
synchronized (mBitmapLocker) {
if (!mBitmaps.isEmpty()) {
bm = mBitmaps.remove(0);
}
}
if (bm != null) {
updateOSD(bm, targetTs.longValue());
TimerRunner runner = new TimerRunner(bm);
mHandler.postDelayed(runner, targetTs.longValue() - ts);
}
} else if (msg.what == 0) {
Looper.myLooper().quitSafely();
}
}
};
updateOSD(mOsdTs);
}
Looper.loop();
}
});
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -177,18 +204,6 @@ public class Camera2VideoActivity extends AppCompatActivity {
Window win = getWindow();
win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
/*
win.setDecorFitsSystemWindows(false);
WindowInsetsController controller = win.getInsetsController();
if (controller != null) {
controller.hide(WindowInsets.Type.statusBars() | WindowInsets.Type.navigationBars());
controller.setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
}
*/
}
setContentView(R.layout.activity_camera2_video);
getSupportActionBar().hide();
@ -214,15 +229,22 @@ public class Camera2VideoActivity extends AppCompatActivity {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
WindowMetrics windowMetrics = wm.getCurrentWindowMetrics();
WindowInsets windowInsets = windowMetrics.getWindowInsets();
Insets insets = windowInsets.getInsetsIgnoringVisibility(WindowInsets.Type.navigationBars() | WindowInsets.Type.displayCutout());
return insets.top;
Insets insets = windowInsets.getInsetsIgnoringVisibility(WindowInsets.Type.statusBars() | WindowInsets.Type.displayCutout());
return px2dip(this, insets.top);
}
Rect frame = new Rect();
getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
int statusBarHeight = frame.top;
return statusBarHeight;
if (statusBarHeight == 0) {
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
}
}
return px2dip(context, statusBarHeight);
}
protected void onCreateActivity() {
@ -239,7 +261,7 @@ public class Camera2VideoActivity extends AppCompatActivity {
mOSDLeftBottom = intent.getStringExtra("leftBottomOsd");
mOSDRightBottom = intent.getStringExtra("rightBottomOsd");
mOSDRightTop = intent.getStringExtra("rightTopOsd");
mOSDMargin = intent.getIntExtra("margin", 0);
mOSDMargin = px2dip(this, intent.getIntExtra("margin", 12));
mCameraWidth = mVideoWidth;
mCameraHeight = mVideoHeight;
@ -310,6 +332,7 @@ public class Camera2VideoActivity extends AppCompatActivity {
long ts = 0;
long zeroTs = 0;
Bitmap bm2 = null;
if (!TextUtils.isEmpty(mOSDLeftTop) || !TextUtils.isEmpty(mOSDLeftTop) || !TextUtils.isEmpty(mOSDLeftTop) || !TextUtils.isEmpty(mOSDLeftTop)) {
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setStyle(Paint.Style.FILL);
@ -323,22 +346,27 @@ public class Camera2VideoActivity extends AppCompatActivity {
mPaintStroker.setTextSize(fontSize);
mPaintStroker.setStrokeWidth(1);
mBitmap = Bitmap.createBitmap(mVideoWidth, mVideoHeight, Bitmap.Config.ARGB_8888);
bm2 = Bitmap.createBitmap(mVideoWidth, mVideoHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(mBitmap);
Bitmap bm = Bitmap.createBitmap(mVideoWidth, mVideoHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bm);
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
ts = System.currentTimeMillis();
zeroTs = ts - (ts % 1000);
initOSD(zeroTs);
initOSD(bm, zeroTs);
mOSDFilter = new GlWatermarkFilter(bm);
mOSDFilter = new GlWatermarkFilter(mBitmap);
if (mGPUCameraRecorder != null) {
mGPUCameraRecorder.setFilter(mOSDFilter);
}
mBitmap = Bitmap.createBitmap(mVideoWidth, mVideoHeight, Bitmap.Config.ARGB_8888);
updateOSD(zeroTs + 1000);
updateOSD(bm2, zeroTs + 1000);
}
final long prevZeroTs = zeroTs;
final Bitmap finalBm = bm2;
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
@ -346,19 +374,29 @@ public class Camera2VideoActivity extends AppCompatActivity {
mGPUCameraRecorder.start(mNextVideoAbsolutePath);
long ts2 = System.currentTimeMillis();
long zeroTs2 = ts2 - (ts2 % 1000);
if (mOSDFilter != null) {
long ts2 = System.currentTimeMillis();
long zeroTs2 = ts2 - (ts2 % 1000);
if (zeroTs2 > prevZeroTs) {
// Next second
mOSDFilter.updateBitmap(mBitmap);
mBitmap = null;
mOsdTs = zeroTs2 + 1000;
mOSDSemaphore.release();
if (zeroTs2 > prevZeroTs) {
// Next second
Bitmap oldBm = mOSDFilter.updateBitmap(finalBm);
if (oldBm != null) {
synchronized (mBitmapLocker) {
mBitmaps.add(oldBm);
}
}
Message msg = Message.obtain();
msg.what = 1;
msg.obj = new Long(zeroTs2 + 1000);
// mOsdTs = zeroTs2 + 1000;
mOsdHandler.sendMessage(msg);
} else {
TimerRunner runner = new TimerRunner(finalBm);
mHandler.postDelayed(runner, 1000 - (ts2 - zeroTs2));
}
Log.d("OSD", "Cur TS=" + Long.toString(ts2 / 1000) + " Timer=" + Long.toString(1000 - (ts2 - zeroTs2)));
}
Log.d("OSD", "Cur TS=" + Long.toString(ts2 / 1000) + " Timer=" + Long.toString(1000 - (ts2 - zeroTs2)));
mHandler.postDelayed(mTimerRunnable, 1000 - (ts2 - zeroTs2));
}
}, 0);
@ -384,7 +422,7 @@ public class Camera2VideoActivity extends AppCompatActivity {
releaseCamera();
}
private void initOSD(long ts) {
private void initOSD(Bitmap bm, long ts) {
Log.d("OSD", "INIT OSD " + Long.toString(ts / 1000));
@ -392,184 +430,183 @@ public class Camera2VideoActivity extends AppCompatActivity {
mStatusBarHeight = getStatusBarHeight(this);
}
int statusHeight = mStatusBarHeight;
synchronized (mBitmapLocker) {
int bmWidth = mBitmap.getWidth();
int bmHeight = mBitmap.getHeight();
int margin = mOSDMargin;
int x = 0;
int y = 0;
// mOSDFilter.
Canvas canvas = new Canvas(mBitmap);
Rect textBounds = new Rect();
int bmWidth = bm.getWidth();
int bmHeight = bm.getHeight();
int margin = mOSDMargin;
int x = 0;
int y = 0;
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
if (!TextUtils.isEmpty(mOSDLeftTop)) {
String[] items = mOSDLeftTop.split("\n");
Point origin = new Point(margin, margin + statusHeight);
Canvas canvas = new Canvas(bm);
Rect textBounds = new Rect();
for (String item : items) {
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
int mask = 0;
if (item.indexOf(TIME_MICRO_TS) != 0) {
mask |= TIME_MASK_LT_TS;
}
if (item.indexOf(TIME_MICRO_DT) != 0) {
mask |= TIME_MASK_LT_DT;
}
if (!TextUtils.isEmpty(mOSDLeftTop)) {
String[] items = mOSDLeftTop.split("\n");
Point origin = new Point(margin, margin + statusHeight);
OSD_ITEM osdItem = new OSD_ITEM();
osdItem.text = item;
osdItem.mask = mask;
osdItem.origin = new Point(origin);
for (String item : items) {
if (mask == 0) {
canvas.drawText(item, origin.x, origin.y, mPaint);
canvas.drawText(item, origin.x, origin.y, mPaintStroker);
int mask = 0;
if (item.indexOf(TIME_MICRO_TS) != 0) {
mask |= TIME_MASK_LT_TS;
}
if (item.indexOf(TIME_MICRO_DT) != 0) {
mask |= TIME_MASK_LT_DT;
}
mPaintStroker.getTextBounds(item, 0, item.length(), textBounds);
} else {
String newText = updateOSDTime(item, ts);
OSD_ITEM osdItem = new OSD_ITEM();
osdItem.text = item;
osdItem.mask = mask;
osdItem.origin = new Point(origin);
canvas.drawText(newText, origin.x, origin.y, mPaint);
canvas.drawText(newText, origin.x, origin.y, mPaintStroker);
if (mask == 0) {
canvas.drawText(item, origin.x, origin.y, mPaint);
canvas.drawText(item, origin.x, origin.y, mPaintStroker);
mPaintStroker.getTextBounds(newText, 0, item.length(), textBounds);
}
mPaintStroker.getTextBounds(item, 0, item.length(), textBounds);
} else {
String newText = updateOSDTime(item, ts);
osdItem.previousRect = new Rect(origin.x, origin.y, origin.x + textBounds.width(), origin.y + textBounds.height());
canvas.drawText(newText, origin.x, origin.y, mPaint);
canvas.drawText(newText, origin.x, origin.y, mPaintStroker);
mOSDItems.add(osdItem);
origin.y += (textBounds.height() * 5) >> 2;
mPaintStroker.getTextBounds(newText, 0, item.length(), textBounds);
}
}
if (!TextUtils.isEmpty(mOSDLeftBottom)) {
osdItem.previousRect = new Rect(origin.x, origin.y, origin.x + textBounds.width(), origin.y + textBounds.height());
String[] items = mOSDLeftBottom.split("\n");
Point origin = new Point(margin, bmHeight - margin);
mOSDItems.add(osdItem);
origin.y += (textBounds.height() * 3) >> 1;
}
}
for(int idx = items.length-1; idx >= 0; idx--) {
if (!TextUtils.isEmpty(mOSDLeftBottom)) {
int mask = 0;
String item = items[idx];
if (item.indexOf(TIME_MICRO_TS) != 0) {
mask |= TIME_MASK_LB_TS;
}
if (item.indexOf(TIME_MICRO_DT) != 0) {
mask |= TIME_MASK_LB_DT;
}
String[] items = mOSDLeftBottom.split("\n");
Point origin = new Point(margin, bmHeight - margin);
OSD_ITEM osdItem = new OSD_ITEM();
osdItem.text = item;
osdItem.mask = mask;
osdItem.origin = new Point(origin);
if (mask == 0) {
mPaintStroker.getTextBounds(item, 0, item.length(), textBounds);
y = origin.y - textBounds.height();
for(int idx = items.length-1; idx >= 0; idx--) {
canvas.drawText(item, origin.x, y, mPaint);
canvas.drawText(item, origin.x, y, mPaintStroker);
} else {
String newText = updateOSDTime(item, ts);
int mask = 0;
String item = items[idx];
if (item.indexOf(TIME_MICRO_TS) != 0) {
mask |= TIME_MASK_LB_TS;
}
if (item.indexOf(TIME_MICRO_DT) != 0) {
mask |= TIME_MASK_LB_DT;
}
mPaintStroker.getTextBounds(newText, 0, newText.length(), textBounds);
y = origin.y - textBounds.height();
OSD_ITEM osdItem = new OSD_ITEM();
osdItem.text = item;
osdItem.mask = mask;
osdItem.origin = new Point(origin);
if (mask == 0) {
mPaintStroker.getTextBounds(item, 0, item.length(), textBounds);
y = origin.y - textBounds.height();
canvas.drawText(newText, origin.x, y, mPaint);
canvas.drawText(newText, origin.x, y, mPaintStroker);
}
canvas.drawText(item, origin.x, y, mPaint);
canvas.drawText(item, origin.x, y, mPaintStroker);
} else {
String newText = updateOSDTime(item, ts);
mPaintStroker.getTextBounds(newText, 0, newText.length(), textBounds);
y = origin.y - textBounds.height();
osdItem.previousRect = new Rect(origin.x, y, origin.x + textBounds.width(), y + textBounds.height());
mOSDItems.add(osdItem);
origin.y -= (textBounds.height() * 5) >> 2;
canvas.drawText(newText, origin.x, y, mPaint);
canvas.drawText(newText, origin.x, y, mPaintStroker);
}
}
if (!TextUtils.isEmpty(mOSDRightTop)) {
osdItem.previousRect = new Rect(origin.x, y, origin.x + textBounds.width(), y + textBounds.height());
mOSDItems.add(osdItem);
origin.y -= (textBounds.height() * 3) >> 1;
}
}
String[] items = mOSDRightTop.split("\n");
Point origin = new Point(bmWidth - margin, margin + statusHeight);
if (!TextUtils.isEmpty(mOSDRightTop)) {
for (String item : items) {
String[] items = mOSDRightTop.split("\n");
Point origin = new Point(bmWidth - margin, margin + statusHeight);
int mask = 0;
if (item.indexOf(TIME_MICRO_TS) != 0) {
mask |= TIME_MASK_RT_TS;
}
if (item.indexOf(TIME_MICRO_DT) != 0) {
mask |= TIME_MASK_RT_DT;
}
for (String item : items) {
OSD_ITEM osdItem = new OSD_ITEM();
osdItem.text = item;
osdItem.origin = new Point(origin);
osdItem.mask = mask;
int mask = 0;
if (item.indexOf(TIME_MICRO_TS) != 0) {
mask |= TIME_MASK_RT_TS;
}
if (item.indexOf(TIME_MICRO_DT) != 0) {
mask |= TIME_MASK_RT_DT;
}
if (mask == 0) {
mPaintStroker.getTextBounds(item, 0, item.length(), textBounds);
OSD_ITEM osdItem = new OSD_ITEM();
osdItem.text = item;
osdItem.origin = new Point(origin);
osdItem.mask = mask;
canvas.drawText(item, origin.x - textBounds.width(), origin.y, mPaint);
canvas.drawText(item, origin.x - textBounds.width(), origin.y, mPaintStroker);
} else {
if (mask == 0) {
mPaintStroker.getTextBounds(item, 0, item.length(), textBounds);
String newText = updateOSDTime(item, ts);
mPaintStroker.getTextBounds(newText, 0, item.length(), textBounds);
canvas.drawText(item, origin.x - textBounds.width(), origin.y, mPaint);
canvas.drawText(item, origin.x - textBounds.width(), origin.y, mPaintStroker);
} else {
canvas.drawText(newText, origin.x - textBounds.width(), origin.y, mPaint);
canvas.drawText(newText, origin.x - textBounds.width(), origin.y, mPaintStroker);
}
osdItem.previousRect = new Rect(origin.x - textBounds.width(), origin.y, origin.x, origin.y + textBounds.height());
mOSDItems.add(osdItem);
String newText = updateOSDTime(item, ts);
mPaintStroker.getTextBounds(newText, 0, item.length(), textBounds);
origin.y += (textBounds.height() * 5) >> 2;
canvas.drawText(newText, origin.x - textBounds.width(), origin.y, mPaint);
canvas.drawText(newText, origin.x - textBounds.width(), origin.y, mPaintStroker);
}
}
osdItem.previousRect = new Rect(origin.x - textBounds.width(), origin.y, origin.x, origin.y + textBounds.height());
mOSDItems.add(osdItem);
if (!TextUtils.isEmpty(mOSDRightBottom)) {
String[] items = mOSDRightBottom.split("\n");
Point origin = new Point(bmWidth - margin, bmHeight - margin);
origin.y += (textBounds.height() * 3) >> 1;
}
}
for(int idx = items.length-1; idx >= 0; idx--) {
if (!TextUtils.isEmpty(mOSDRightBottom)) {
int mask = 0;
String item = items[idx];
if (item.indexOf(TIME_MICRO_TS) != 0) {
mask |= TIME_MASK_RB_TS;
}
if (item.indexOf(TIME_MICRO_DT) != 0) {
mask |= TIME_MASK_RB_DT;
}
String[] items = mOSDRightBottom.split("\n");
Point origin = new Point(bmWidth - margin, bmHeight - margin);
OSD_ITEM osdItem = new OSD_ITEM();
osdItem.text = item;
osdItem.origin = new Point(origin);
osdItem.mask = mask;
if (mask == 0) {
mPaintStroker.getTextBounds(item, 0, item.length(), textBounds);
for(int idx = items.length-1; idx >= 0; idx--) {
canvas.drawText(item, origin.x - textBounds.width(), origin.y - textBounds.height(), mPaint);
canvas.drawText(item, origin.x - textBounds.width(), origin.y - textBounds.height(), mPaintStroker);
} else {
String newText = updateOSDTime(item, ts);
mPaintStroker.getTextBounds(newText, 0, item.length(), textBounds);
int mask = 0;
String item = items[idx];
if (item.indexOf(TIME_MICRO_TS) != 0) {
mask |= TIME_MASK_RB_TS;
}
if (item.indexOf(TIME_MICRO_DT) != 0) {
mask |= TIME_MASK_RB_DT;
}
canvas.drawText(newText, origin.x - textBounds.width(), origin.y - textBounds.height(), mPaint);
canvas.drawText(newText, origin.x - textBounds.width(), origin.y - textBounds.height(), mPaintStroker);
}
OSD_ITEM osdItem = new OSD_ITEM();
osdItem.text = item;
osdItem.origin = new Point(origin);
osdItem.mask = mask;
if (mask == 0) {
mPaintStroker.getTextBounds(item, 0, item.length(), textBounds);
canvas.drawText(item, origin.x - textBounds.width(), origin.y - textBounds.height(), mPaint);
canvas.drawText(item, origin.x - textBounds.width(), origin.y - textBounds.height(), mPaintStroker);
} else {
String newText = updateOSDTime(item, ts);
mPaintStroker.getTextBounds(newText, 0, item.length(), textBounds);
canvas.drawText(newText, origin.x - textBounds.width(), origin.y - textBounds.height(), mPaint);
canvas.drawText(newText, origin.x - textBounds.width(), origin.y - textBounds.height(), mPaintStroker);
}
osdItem.previousRect = new Rect(origin.x - textBounds.width(), origin.y - textBounds.height(), origin.x, origin.y);
mOSDItems.add(osdItem);
osdItem.previousRect = new Rect(origin.x - textBounds.width(), origin.y - textBounds.height(), origin.x, origin.y);
mOSDItems.add(osdItem);
origin.y -= (textBounds.height() * 5) >> 2;
}
origin.y -= (textBounds.height() * 3) >> 1;
}
}
}
private void updateOSD(long ts) {
private void updateOSD(Bitmap bm, long ts) {
Log.d("OSD", "prepareOSD " + Long.toString(ts / 1000));
if (mStatusBarHeight == -1) {
@ -577,8 +614,6 @@ public class Camera2VideoActivity extends AppCompatActivity {
}
int statusHeight = mStatusBarHeight;
Bitmap bm = Bitmap.createBitmap(mVideoWidth, mVideoHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bm);
boolean aa = canvas.isHardwareAccelerated();
Rect textBounds = new Rect();
@ -629,9 +664,6 @@ public class Camera2VideoActivity extends AppCompatActivity {
}
}
synchronized (mBitmapLocker) {
mBitmap = bm;
}
}
private String updateOSDTime(String osd, long ts) {
@ -679,11 +711,8 @@ public class Camera2VideoActivity extends AppCompatActivity {
if (mGPUCameraRecorder == null) return;
mGPUCameraRecorder.changeManualFocusPoint(event.getX(), event.getY(), width, height);
});
frameLayout.addView(mPreviewView);
if (mGPUCameraRecorder != null) {
mGPUCameraRecorder.setFilter(mOSDFilter);
}
frameLayout.addView(mPreviewView);
});
}
@ -704,9 +733,11 @@ public class Camera2VideoActivity extends AppCompatActivity {
@Override
public void onRecordComplete() {
mHandler.removeCallbacks(mTimerRunnable);
mOsdTs = -1;
mOSDSemaphore.release();
// mHandler.removeCallbacks(mTimerRunnable);
Message msg = Message.obtain();
msg.what = 0;
mOsdHandler.sendMessage(msg);
exportMp4ToGallery(getApplicationContext(), mNextVideoAbsolutePath);
broadcastVideoFile(true, mNextVideoAbsolutePath);
mHandler.postDelayed(new Runnable() {

@ -23,7 +23,7 @@ public class GlWatermarkFilter extends GlOverlayFilter {
mPosition = position;
}
public void updateBitmap(Bitmap bm) {
public Bitmap updateBitmap(Bitmap bm) {
Bitmap oldBitmap = null;
Log.d("OSD", "updateBitmap");
synchronized (mLocker) {
@ -32,9 +32,7 @@ public class GlWatermarkFilter extends GlOverlayFilter {
mBitmap = bm;
}
if (oldBitmap != null) {
// oldBitmap.recycle();
}
return oldBitmap;
}
@Override

Loading…
Cancel
Save