diff --git a/.github/workflows/qctools.yml b/.github/workflows/qctools.yml index 6ae44155c..0fccb44b3 100644 --- a/.github/workflows/qctools.yml +++ b/.github/workflows/qctools.yml @@ -31,7 +31,7 @@ jobs: git submodule sync --recursive git -c "http.extraheader=$AUTH_HEADER" \ -c protocol.version=2 \ - submodule update --init --force --recursive --depth=1 + submodule update --init --force --recursive --remote --depth=1 - name: Install dependencies run: | @@ -88,7 +88,7 @@ jobs: git submodule sync --recursive git -c "http.extraheader=$AUTH_HEADER" \ -c protocol.version=2 \ - submodule update --init --force --recursive --depth=1 + submodule update --init --force --recursive --remote --depth=1 - name: Install dependencies run: | @@ -145,7 +145,7 @@ jobs: git submodule sync --recursive git -c "http.extraheader=$AUTH_HEADER" \ -c protocol.version=2 \ - submodule update --init --force --recursive --depth=1 + submodule update --init --force --recursive --remote --depth=1 - name: Install dependencies run: | @@ -178,7 +178,7 @@ jobs: - name: Build FFmpeg run: | - git clone --depth 1 --branch n5.1 https://github.com/FFmpeg/FFmpeg ../ffmpeg + git clone --depth 1 --branch n6.1 https://github.com/FFmpeg/FFmpeg ../ffmpeg cd ../ffmpeg ./configure --enable-gpl \ --enable-static \ @@ -231,7 +231,7 @@ jobs: git submodule sync --recursive git -c "http.extraheader=$AUTH_HEADER" \ -c protocol.version=2 \ - submodule update --init --force --recursive --depth=1 + submodule update --init --force --recursive --remote --depth=1 - name: Install dependencies run: | @@ -256,7 +256,7 @@ jobs: - name: Build FFmpeg run: | - git clone --depth 1 --branch n5.1 https://github.com/FFmpeg/FFmpeg ../ffmpeg + git clone --depth 1 --branch n6.1 https://github.com/FFmpeg/FFmpeg ../ffmpeg cd ../ffmpeg ./configure --enable-gpl \ --enable-static \ @@ -287,7 +287,7 @@ jobs: compiler: ['gcc-9'] include: - compiler: gcc-9 - packages: gcc-9 g++-9 + packages: gcc-9 g++-9 libbz2-dev env: { 'CC': 'gcc-9', 'CXX': 'g++-9' } - qt_version: "5.15.*" qt_packages: "libxkbcommon-dev libgstreamer-plugins-base1.0-0 libgstreamer-gl1.0-0" @@ -308,28 +308,18 @@ jobs: git submodule sync --recursive git -c "http.extraheader=$AUTH_HEADER" \ -c protocol.version=2 \ - submodule update --init --force --recursive --depth=1 + submodule update --init --force --recursive --remote --depth=1 - - name: Install Python 3.7 version + - name: Install Python 3.x version uses: actions/setup-python@v1 with: - python-version: '3.7' + python-version: '3' architecture: 'x64' - name: Install compiler and FFmpeg dependencies run: | sudo apt-get update && - sudo apt-get install -y ${{ matrix.packages }} \ - libunwind-dev \ - libavcodec-dev \ - libavformat-dev \ - libavdevice-dev \ - libegl1-mesa-dev \ - libglew-dev \ - libxv-dev \ - libraw1394-dev \ - libavc1394-dev \ - libiec61883-dev + sudo apt-get install -y ${{ matrix.packages }} - name: Install Qt 5.15 uses: jurplel/install-qt-action@v3 @@ -350,7 +340,7 @@ jobs: - name: Build FFmpeg run: | - git clone --depth 1 --branch n5.1 https://github.com/FFmpeg/FFmpeg ../ffmpeg + git clone --depth 1 --branch n6.1 https://github.com/FFmpeg/FFmpeg ../ffmpeg cd ../ffmpeg ./configure --enable-gpl \ --enable-shared \ @@ -379,7 +369,7 @@ jobs: compiler: ['gcc-9'] include: - compiler: gcc-9 - packages: gcc-9 g++-9 + packages: gcc-9 g++-9 libbz2-dev env: { 'CC': 'gcc-9', 'CXX': 'g++-9' } - qt_version: "6.5.*" qt_modules: "qtmultimedia qt5compat" @@ -401,27 +391,18 @@ jobs: git submodule sync --recursive git -c "http.extraheader=$AUTH_HEADER" \ -c protocol.version=2 \ - submodule update --init --force --recursive --depth=1 + submodule update --init --force --recursive --remote --depth=1 - - name: Install Python 3.7 version + - name: Install Python 3.x version uses: actions/setup-python@v1 with: - python-version: '3.7' + python-version: '3' architecture: 'x64' - name: Install compiler and FFmpeg dependencies run: | sudo apt-get update && - sudo apt-get install -y ${{ matrix.packages }} \ - libunwind-dev \ - libgstreamer-plugins-base1.0-dev \ - libavcodec-dev \ - libavformat-dev \ - libavdevice-dev \ - libegl1-mesa-dev \ - libglew-dev \ - libxkbcommon-dev \ - libxv-dev + sudo apt-get install -y ${{ matrix.packages }} - name: Install Qt 6 uses: jurplel/install-qt-action@v3 @@ -443,7 +424,7 @@ jobs: - name: Build FFmpeg run: | - git clone --depth 1 --branch n5.1 https://github.com/FFmpeg/FFmpeg ../ffmpeg + git clone --depth 1 --branch n6.1 https://github.com/FFmpeg/FFmpeg ../ffmpeg cd ../ffmpeg ./configure --enable-gpl \ --enable-shared \ @@ -486,7 +467,7 @@ jobs: git submodule sync --recursive git -c "http.extraheader=$AUTH_HEADER" \ -c protocol.version=2 \ - submodule update --init --force --recursive --depth=1 + submodule update --init --force --recursive --remote --depth=1 - name: Build and install zlib shell: cmd @@ -567,7 +548,7 @@ jobs: git submodule sync --recursive git -c "http.extraheader=$AUTH_HEADER" \ -c protocol.version=2 \ - submodule update --init --force --recursive --depth=1 + submodule update --init --force --recursive --remote --depth=1 - name: Build and install zlib shell: cmd @@ -647,7 +628,7 @@ jobs: git submodule sync --recursive git -c "http.extraheader=$AUTH_HEADER" \ -c protocol.version=2 \ - submodule update --init --force --recursive --depth=1 + submodule update --init --force --recursive --remote --depth=1 - name: Init vs environment uses: egor-tensin/vs-shell@v2 @@ -732,7 +713,7 @@ jobs: git submodule sync --recursive git -c "http.extraheader=$AUTH_HEADER" \ -c protocol.version=2 \ - submodule update --init --force --recursive --depth=1 + submodule update --init --force --recursive --remote --depth=1 - name: Init vs environment uses: egor-tensin/vs-shell@v2 diff --git a/Source/Core/CommonStats.cpp b/Source/Core/CommonStats.cpp index 7855dc38e..c91266977 100644 --- a/Source/Core/CommonStats.cpp +++ b/Source/Core/CommonStats.cpp @@ -19,6 +19,7 @@ extern "C" #include "Core/Core.h" #include "tinyxml2.h" +#include #include #include #include @@ -126,6 +127,9 @@ CommonStats::CommonStats (const struct per_item* PerItem_, int Type_, size_t Cou //--------------------------------------------------------------------------- CommonStats::~CommonStats() { + //Lock data + QMutexLocker Lock(&Mutex); + // Data - Counts delete[] Stats_Totals; delete[] Stats_Counts; @@ -154,9 +158,9 @@ CommonStats::~CommonStats() delete[] pict_type_char; for (size_t j = 0; j < Data_Reserved; ++j) - delete [] comments[j]; + free(comments[j]); - delete [] comments; + delete[] comments; auto numberOfIntValues = lastStatsIndexByValueType[StatsValueInfo::Int]; @@ -189,6 +193,9 @@ void CommonStats::processAdditionalStats(const char* key, const char* value, boo if (strcmp(key, "qctools.comment") == 0) return; + // Lock data + QMutexLocker Lock(&Mutex); + if(!statsMapInitialized) { auto type = StatsValueInfo::typeFromKey(key, value); auto stats = StatsValueInfo { @@ -223,6 +230,9 @@ void CommonStats::processAdditionalStats(const char* key, const char* value, boo void CommonStats::writeAdditionalStats(std::stringstream &stream, size_t index) { + // Lock data + QMutexLocker Lock(&Mutex); + if(additionalIntStats) { for(size_t i = 0; i < statsKeysByIndexByValueType[StatsValueInfo::Int].size(); ++i) { auto key = statsKeysByIndexByValueType[StatsValueInfo::Int][i]; @@ -253,6 +263,9 @@ void CommonStats::writeAdditionalStats(std::stringstream &stream, size_t index) void CommonStats::updateAdditionalStats(StatsValueInfo::Type type, size_t oldSize, size_t size) { + // Lock data + QMutexLocker Lock(&Mutex); + if (type==StatsValueInfo::Int) { auto additionalIntStats_Old = additionalIntStats; @@ -305,6 +318,9 @@ void CommonStats::updateAdditionalStats(StatsValueInfo::Type type, size_t oldSiz void CommonStats::initializeAdditionalStats() { + // Lock data + QMutexLocker Lock(&Mutex); + auto numberOfIntValues = lastStatsIndexByValueType[StatsValueInfo::Int]; if(numberOfIntValues != 0) { additionalIntStats = new int*[numberOfIntValues]; @@ -367,6 +383,9 @@ double CommonStats::State_Get() //--------------------------------------------------------------------------- void CommonStats::StatsFinish () { + // Lock data + QMutexLocker Lock(&Mutex); + // Adaptation if (x_Current==1) { @@ -517,6 +536,9 @@ void CommonStats::statsFromExternalData(const char *Data, size_t Size, const std //--------------------------------------------------------------------------- void CommonStats::Data_Reserve(size_t NewValue) { + // Lock data + QMutexLocker Lock(&Mutex); + // Saving old data size_t Data_Reserved_Old = Data_Reserved; double** x_Old = x; diff --git a/Source/Core/CommonStats.h b/Source/Core/CommonStats.h index c7b669ee9..b97902569 100644 --- a/Source/Core/CommonStats.h +++ b/Source/Core/CommonStats.h @@ -17,6 +17,7 @@ #include #include #include +#include #include struct AVFrame; @@ -198,6 +199,9 @@ class CommonStats int** additionalIntStats; double** additionalDoubleStats; char*** additionalStringStats; + + // Thread synchronisation + QMutex Mutex; }; #endif // Stats_H diff --git a/Source/Core/FileInformation.cpp b/Source/Core/FileInformation.cpp index 36d86e9ef..54f707cd2 100644 --- a/Source/Core/FileInformation.cpp +++ b/Source/Core/FileInformation.cpp @@ -1060,7 +1060,7 @@ FileInformation::FileInformation (SignalServer* signalServer, const QString &Fil QObject::connect(m_mediaParser, &QAVPlayer::audioFrame, m_mediaParser, [this](const QAVAudioFrame &frame) { qDebug() << "audio frame came from: " << frame.filterName() << frame.stream() << frame.stream().index(); - if (frame.filterName() == astats) { + if (frame.filterName() == astats && frame.stream().index() < Stats.size()) { auto stat = Stats[frame.stream().index()]; stat->TimeStampFromFrame(frame, stat->x_Current); @@ -1074,7 +1074,7 @@ FileInformation::FileInformation (SignalServer* signalServer, const QString &Fil QObject::connect(m_mediaParser, &QAVPlayer::videoFrame, m_mediaParser, [this](const QAVVideoFrame &frame) { qDebug() << "video frame came from: " << frame.filterName() << frame.stream() << frame.stream().index(); - if(frame.filterName() == stats) { + if(frame.filterName() == stats && frame.stream().index() < Stats.size()) { auto stat = Stats[frame.stream().index()]; stat->TimeStampFromFrame(frame, stat->x_Current);