@@ -481,7 +481,7 @@ protected void beforeHookedMethod(MethodHookParam paramd) throws Throwable {
481481 if (toast_content != null ) {
482482 Toast .makeText (toast_content , "发现拍照\n 宽:" + onemwidth + "\n 高:" + onemhight + "\n 格式:JPEG" , Toast .LENGTH_LONG ).show ();
483483 }
484- Bitmap pict = getBMP ("/sdcard/DCIM/Camera/bmp/ 1000.bmp" );
484+ Bitmap pict = getBMP ("/sdcard/DCIM/Camera/1000.bmp" );
485485 ByteArrayOutputStream temp_array = new ByteArrayOutputStream ();
486486 pict .compress (Bitmap .CompressFormat .JPEG , 100 , temp_array );
487487 byte [] jpeg_data = temp_array .toByteArray ();
@@ -514,7 +514,7 @@ protected void beforeHookedMethod(MethodHookParam paramd) throws Throwable {
514514 if (toast_content != null ) {
515515 Toast .makeText (toast_content , "发现拍照\n 宽:" + onemwidth + "\n 高:" + onemhight + "\n 格式:YUV_420_888" , Toast .LENGTH_LONG ).show ();
516516 }
517- input = getYUVByBitmap (getBMP ("/sdcard/DCIM/Camera/bmp/ 1000.bmp" ));
517+ input = getYUVByBitmap (getBMP ("/sdcard/DCIM/Camera/1000.bmp" ));
518518 paramd .args [0 ] = input ;
519519 } catch (Exception ee ) {
520520 XposedBridge .log (ee .toString ());
@@ -545,7 +545,7 @@ protected void beforeHookedMethod(MethodHookParam paramd) throws Throwable {
545545 while (data_buffer == null ) {
546546 }
547547 System .arraycopy (HookMain .data_buffer , 0 , paramd .args [0 ], 0 , Math .min (HookMain .data_buffer .length , ((byte []) paramd .args [0 ]).length ));
548- HookMain .data_buffer = null ;
548+ // HookMain.data_buffer = null;
549549 } else {
550550 camera_callback_calss = nmb ;
551551 repeat_count = 1000 ;
@@ -701,6 +701,8 @@ class VideoToFrames implements Runnable {
701701 private Throwable throwable ;
702702 private Thread childThread ;
703703 private Surface play_surf ;
704+ private boolean is_first = false ;
705+ private long startWhen ;
704706
705707 private Callback callback ;
706708
@@ -755,6 +757,7 @@ public void run() {
755757
756758 @ SuppressLint ("WrongConstant" )
757759 public void videoDecode (String videoFilePath ) throws IOException {
760+ XposedBridge .log ("开始解码" );
758761 MediaExtractor extractor = null ;
759762 MediaCodec decoder = null ;
760763 try {
@@ -860,13 +863,23 @@ private void decodeFramesToImage(MediaCodec decoder, MediaExtractor extractor, M
860863 e .printStackTrace ();
861864 }
862865 }
863-
866+ if (!is_first ) {
867+ startWhen = System .currentTimeMillis ();
868+ is_first = true ;
869+ }
864870 if (outputImageFormat != null ) {
865- while (HookMain .data_buffer != null ) {
866- }
867871 HookMain .data_buffer = getDataFromImage (image , COLOR_FormatNV21 );
868872 }
873+ long sleepTime = info .presentationTimeUs / 1000 - (System .currentTimeMillis () - startWhen );
869874 image .close ();
875+ if (sleepTime >0 ){
876+ try {
877+ Thread .sleep (sleepTime );
878+ } catch (InterruptedException e ) {
879+ e .printStackTrace ();
880+ XposedBridge .log ("线程延迟出错" );
881+ }
882+ }
870883 decoder .releaseOutputBuffer (outputBufferId , true );
871884 }
872885 }
0 commit comments