瀏覽代碼

修复videodecode没有播放的问题

huihui 4 年之前
父節點
當前提交
438c914721

+ 1 - 0
.gitignore

@@ -12,3 +12,4 @@ source/OtherDemo/mydemo/FilterDemo/TestAvFilter.pro.user
 source/build-VideoDecode-Desktop_Qt_5_13_2_MSVC2017_32bit_654258-Release
 /build-FFmpegDemo-Desktop_Qt_5_13_2_MSVC2017_32bit_654258-Debug
 /build-FFmpegDemo-Desktop_Qt_5_13_2_MSVC2017_32bit_654258-Release
+source/FFmpegDemo.pro.user

+ 1 - 1
source/VideoDecode/VideoDecode.pro

@@ -8,7 +8,7 @@ QT       += core gui
 
 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 
-TARGET = VideoDecode2
+TARGET = VideoDecode
 TEMPLATE = app
 
 CONFIG += c++11

+ 14 - 15
source/VideoDecode/VideoDecoder/src/VideoReader/FFmpegVideoParsing.cpp

@@ -199,24 +199,23 @@ do
 
     fprintf(stderr, "... %d \n", ret);
 
-//    while (1)
-//    {
-//        AVPacket packet;
-//        int ret = av_read_frame(pFormatCtx, &packet);
-
-//        if (ret != 0 && mIsStop)
-//        {
-//            break;
-//        }
+    while (1)
+    {
+        AVPacket packet;
+        int ret = av_read_frame(pFormatCtx, &packet);
 
-//        if (mCallBackFunc != nullptr)
-//        {
-//            mCallBackFunc((uint8_t*)packet.data, packet.size, mCallBackFuncParam);
-//        }
+        if (ret != 0 && mIsStop)
+        {
+            break;
+        }
 
-//        av_packet_unref(&packet);
-//    }
+        if (mCallBackFunc != nullptr)
+        {
+            mCallBackFunc((uint8_t*)packet.data, packet.size, mCallBackFuncParam);
+        }
 
+        av_packet_unref(&packet);
+    }
 
 
 }while(0);

+ 0 - 2
source/VideoDecode/VideoDecoder/src/VideoReader/ReadVideoFileThread.cpp

@@ -52,8 +52,6 @@ void ReadVideoFileThread::startRead(char* filePath, AVCodecID id)
     //启动新的线程实现读取视频文件
     std::thread([=]
     {
-        for (int i=0;i<10000;i++) //测试稳定性
-
         this->run(id);
 
     }).detach();