Browse Source

add log 2

DevYK 3 years ago
parent
commit
f944444251
2 changed files with 15 additions and 3 deletions
  1. 10 2
      src/ffmpeg/av_decode.cpp
  2. 5 1
      src/utils/video_similarity.cpp

+ 10 - 2
src/ffmpeg/av_decode.cpp

@@ -269,7 +269,7 @@ long initDecoder(const char *url, int force_Iframe, DisableMediaType disableMedi
             close_decoder((long) dctx);
             return ret;
         }
-        dctx->audio_queue = new BlockQueue<AVFrame *>(dctx->fps);
+//        dctx->audio_queue = new BlockQueue<AVFrame *>(dctx->fps);
         dctx->video_queue = new BlockQueue<AVFrame *>(dctx->fps);
     }
 
@@ -316,6 +316,7 @@ void seekToMs(DecoderContext *dctx, int64_t offset) {
 }
 
 void close_decoder(long decodec_id) {
+    LOGE("close_decoder \n");
     if (decodec_id > 0) {
         struct DecoderContext *ctx = (struct DecoderContext *) decodec_id;
         if (ctx->url) {
@@ -368,7 +369,9 @@ void close_decoder(long decodec_id) {
         }
         free(ctx);
         ctx = NULL;
+
     }
+    LOGE("close_decoder out\n");
 }
 
 int av_read_decode_frame(long decodec_id) {
@@ -446,8 +449,13 @@ void *av_read_decode_thread(void *pVoid) {
                 }
             }
         }
-        ctx->audio_queue->PushBack(NULL);
+        if (ctx->audio_queue){
+            LOGE("push empty packet audio !\n");
+            ctx->audio_queue->PushBack(NULL);
+        }
+        LOGE("push empty packet video !\n");
         ctx->video_queue->PushBack(NULL);
     }
+    LOGE("read thread exit !\n");
     pthread_exit(NULL);
 }

+ 5 - 1
src/utils/video_similarity.cpp

@@ -167,14 +167,16 @@ int video_similarity_detection_start(long id, int force_keyframe,
         av_frame_free(&video_frame);
         if (ctx->log) fprintf(ctx->log, "av_frame_free 2\n");
     }
+
     if (ctx->log) fprintf(ctx->log, "loop exit \n");
+    LOGE("loop exit \n");
     return 0;
 }
 
 int video_similarity_detection_close(long id) {
     if (id <= 0)return -1;
     auto *ctx = (VideoSimilarityContext *) id;
-
+    LOGE("video_similarity_detection_close \n");
     if (ctx->video_path) {
         free((void *) ctx->video_path);
         ctx->video_path = NULL;
@@ -186,6 +188,7 @@ int video_similarity_detection_close(long id) {
     close_decoder(ctx->decode_obj_id);
     free(ctx);
     ctx = NULL;
+    LOGE("video_similarity_detection_close out\n");
     return 0;
 }
 
@@ -312,6 +315,7 @@ const char *get_video_similarity_list(const char *inputjson) {
         ret_json = videoSimilarity2json(vs);
         delete vs;
         vs = NULL;
+        LOGE("get_video_similarity_list out \n");
     }
     return ret_json;
 }