Recherche avancée

Médias (0)

Mot : - Tags -/alertes

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (54)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

Sur d’autres sites (9098)

  • Getting and decoding video by RTP H264

    29 novembre 2023, par AlekseiKraev

    Parsing RTP H264.
WINAPI C. A queue from C++ has been applied, I repent.

    


    RTP is generated using FFMPEG with the following command :
ffmpeg.exe -f gdigrab -framerate 25 -i desktop -s 853x480 -b:v 120000 -c:v libx264 -f rtp rtp ://127.0.0.1:8080

    


    Parsing the incoming RTP/h264 stream and converting it to an RGB matrix.

    


    video_H264_decode.h

    


    #pragma once
#ifndef _VIDEO_H264_DECODE_SEND_H // Блокируем повторное включение этого модуля
#define _VIDEO_H264_DECODE_SEND_H
//******************************************************************************
// Section include
//******************************************************************************
#include "main.h"
#include 
//******************************************************************************
// Constants
//******************************************************************************

//******************************************************************************
// Type
//******************************************************************************
typedef struct {
    unsigned char* data;
    int size;
}RTPData_DType;

typedef struct 
{
    union
    {
        struct
        {
            char V:2;               //Версия
            char P:1;               //заполнение
            char X:1;               //расширение
            char CC:4;              //количество CSRC

            char M:1;               //маркер (флаг последнего пакета AU),
            char PT:7;              //полезная нагрузка (тип данных носителя полезной нагрузки RTP, H264 = 96)

            short sequence_number;  //Порядковый номер: порядковый номер пакета RTP, увеличенный на 1.
            int time_stamp;         //временная метка выборки медиа. 
            int SSRC;               //Пакет данных имеет одинаковое происхождение.
        };
        unsigned char data[12];
    };
}RTPHeader_DType;
//******************************************************************************
// Global var
//******************************************************************************

//******************************************************************************
// Local function prototype
//******************************************************************************
UCHAR rtp_H264_recive_init(void);
UCHAR RTPStop(void);
//******************************************************************************
// Macros
//******************************************************************************
#define BYTE2_SWAP(X)   ((((short)(X) & 0xff00) >> 8) |(((short)(X) & 0x00ff) << 8))
#endif
//******************************************************************************
// ENF OF FILE
//******************************************************************************


    


    video_H264_decode.c

    


    //******************************************************************************&#xA;//include&#xA;//******************************************************************************&#xA;#include "main.h"&#xA;/*#include "video_H264_decode.h"&#xA;#include &#xA;#include &#xA;#include <chrono>&#xA;#include &#xA;&#xA;#pragma comment(lib, "ws2_32.lib")&#xA;#include */&#xA;#include <iostream>&#xA;#include <queue>&#xA;&#xA;extern "C" {&#xA;#include "libavformat/avformat.h"&#xA;#include "libavfilter/avfilter.h"&#xA;#include "libavdevice/avdevice.h"&#xA;#include "libswscale/swscale.h"&#xA;#include "libswresample/swresample.h"&#xA;#include "libpostproc/postprocess.h"&#xA;#include "libavcodec/avcodec.h"&#xA;}&#xA;&#xA;#pragma comment(lib,"avcodec.lib")&#xA;#pragma comment(lib,"avdevice.lib")&#xA;#pragma comment(lib,"avfilter.lib")&#xA;#pragma comment(lib,"avformat.lib")&#xA;#pragma comment(lib,"avutil.lib")&#xA;#pragma comment(lib,"postproc.lib")&#xA;#pragma comment(lib,"swresample.lib")&#xA;#pragma comment(lib,"swscale.lib")&#xA;&#xA;#pragma warning(disable: 4996)&#xA;//******************************************************************************&#xA;// Section for determining the variables used in the module&#xA;//******************************************************************************&#xA;//------------------------------------------------------------------------------&#xA;// Global&#xA;//------------------------------------------------------------------------------&#xA;&#xA;//------------------------------------------------------------------------------&#xA;// Local&#xA;//------------------------------------------------------------------------------&#xA;const int inteval = 0x01000000;&#xA;BOOL FlagRTPActive = TRUE;&#xA;&#xA;HANDLE hMutexRTPRecive;&#xA;HANDLE hSemaphoreRTP;&#xA;HANDLE hTreadRTPRecive;&#xA;HANDLE hTreadRTPDecode;&#xA;&#xA;&#xA;SOCKET RTPSocket; //socket UDP RTP&#xA;RTPData_DType packet;&#xA;RTPData_DType FU_buffer = { 0 };&#xA;&#xA;std::queue q;&#xA;std::set<int> seq;&#xA;&#xA;AVFormatContext* pAVFormatContext;&#xA;AVCodecContext* pAVCodecContext;&#xA;const AVCodec* pAVCodec;&#xA;AVFrame* pAVFrame;&#xA;AVFrame* AVFrameRGG;&#xA;SwsContext* pSwsContext;&#xA;AVPacket *pAVPacket;&#xA;AVCodecParserContext* pAVCodecParserContext;&#xA;&#xA;UINT port;&#xA;//******************************************************************************&#xA;// Section of prototypes of local functions&#xA;//******************************************************************************&#xA;DWORD WINAPI rtp_H264_recive_Procedure(CONST LPVOID lpParam);&#xA;DWORD WINAPI rtp_decode_Procedure(CONST LPVOID lpParam);&#xA;char RTPSocketInit(void);&#xA;void RTPPacketParser(void);&#xA;char RTPSocketRecive(void);&#xA;void Decode_NaluToAVFrameRGG();&#xA;//******************************************************************************&#xA;// Section of the description of functions&#xA;//******************************************************************************&#xA;UCHAR rtp_H264_recive_init(void)&#xA;{&#xA;    hSemaphoreRTP = CreateSemaphore(&#xA;        NULL,           // default security attributes&#xA;        0,              // initial count&#xA;        1,              // maximum count&#xA;        NULL);          // unnamed semaphore&#xA;&#xA;    hMutexRTPRecive = CreateMutex(&#xA;        NULL,              // default security attributes&#xA;        FALSE,             // initially not owned&#xA;        NULL);             // unnamed mutex&#xA;&#xA;    hTreadRTPRecive = CreateThread(NULL, NULL, rtp_H264_recive_Procedure, NULL, NULL, NULL);&#xA;    hTreadRTPDecode = CreateThread(NULL, NULL, rtp_decode_Procedure, NULL, NULL, NULL);&#xA;&#xA;    return 0;&#xA;}&#xA;//------------------------------------------------------------------------------&#xA;UCHAR RTPStop(void)&#xA;{&#xA;    FlagRTPActive = FALSE;&#xA;&#xA;    if (hSemaphoreRTP) CloseHandle(hSemaphoreRTP);&#xA;    if (hMutexRTPRecive) CloseHandle(hMutexRTPRecive);&#xA;    if (hTreadRTPRecive) CloseHandle(hTreadRTPRecive);&#xA;&#xA;    closesocket(RTPSocket);  &#xA;&#xA;    return 0;&#xA;}&#xA;//------------------------------------------------------------------------------&#xA;DWORD WINAPI rtp_H264_recive_Procedure(CONST LPVOID lpParam)&#xA;{&#xA;    while (RTPSocketInit() == 0)&#xA;        Sleep(2000);&#xA;       &#xA;    while (1)&#xA;    {&#xA;        RTPSocketRecive();&#xA;        RTPPacketParser();&#xA;        ReleaseSemaphore(hSemaphoreRTP, 1, NULL);&#xA;    }&#xA;}&#xA;//------------------------------------------------------------------------------&#xA;DWORD WINAPI rtp_decode_Procedure(CONST LPVOID lpParam)&#xA;{&#xA;    port = param.Option.VideoPort;&#xA;&#xA;    pAVPacket = av_packet_alloc();&#xA;    if (!pAVPacket)&#xA;    {&#xA;        MessageBox(NULL, L"ERROR Could not allocate pAVPacket", L"Init decoder error", MB_OK | MB_ICONERROR);&#xA;        exit(1);&#xA;    }&#xA;    av_init_packet(pAVPacket);&#xA;&#xA;    /* find the MPEG-1 video decoder */&#xA;    pAVCodec = avcodec_find_decoder(AV_CODEC_ID_H264);&#xA;    if (!pAVCodec)&#xA;    {&#xA;        MessageBox(NULL, L"ERROR Codec not found", L"Init decoder error", MB_OK | MB_ICONERROR);&#xA;        exit(1);&#xA;    }&#xA;&#xA;    pAVCodecParserContext = av_parser_init(pAVCodec->id);&#xA;    if (!pAVCodecParserContext)&#xA;    {&#xA;        MessageBox(NULL, L"ERROR Parser not found", L"Init decoder error", MB_OK | MB_ICONERROR);&#xA;        exit(1);&#xA;    }&#xA;&#xA;    pAVCodecContext = avcodec_alloc_context3(pAVCodec);&#xA;    if (!pAVCodecContext) &#xA;    {&#xA;        MessageBox(NULL, L"ERROR Could not allocate video codec context", L"Init decoder error", MB_OK | MB_ICONERROR);&#xA;        exit(1);&#xA;    }&#xA;               &#xA;    if (avcodec_open2(pAVCodecContext, pAVCodec, NULL) &lt; 0)&#xA;    {&#xA;        MessageBox(NULL, L"ERROR Could not open codec", L"Init decoder error", MB_OK | MB_ICONERROR);&#xA;        exit(1);&#xA;    }&#xA;&#xA;    pAVFrame = av_frame_alloc();&#xA;    if (!pAVFrame) &#xA;    {&#xA;        MessageBox(NULL, L"ERROR Could not allocate video frame", L"Init decoder error", MB_OK | MB_ICONERROR);&#xA;        exit(1);&#xA;    }    &#xA;    &#xA;    while (FlagRTPActive)&#xA;    {&#xA;        if(port != param.Option.VideoPort)&#xA;            closesocket(RTPSocket);&#xA;&#xA;        WaitForSingleObject(hSemaphoreRTP, 500);        &#xA;        Decode_NaluToAVFrameRGG();&#xA;    }&#xA;&#xA;    avformat_free_context(pAVFormatContext);&#xA;    av_frame_free(&amp;pAVFrame);&#xA;    avcodec_close(pAVCodecContext);&#xA;    av_packet_free(&amp;pAVPacket);&#xA;&#xA;    &#xA;    if (hTreadRTPDecode) CloseHandle(hTreadRTPDecode);&#xA;&#xA;    return 0;&#xA;}&#xA;&#xA;//------------------------------------------------------------------------------&#xA;char RTPSocketInit(void)&#xA;{    &#xA;    sockaddr_in RTPSocketAddr;&#xA;    &#xA;    RTPSocketAddr.sin_family = AF_INET;&#xA;    RTPSocketAddr.sin_addr.s_addr = htonl(INADDR_ANY);&#xA;    RTPSocketAddr.sin_port = htons(param.Option.VideoPort);&#xA;&#xA;    RTPSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);&#xA;    if (RTPSocket == INVALID_SOCKET)&#xA;    {&#xA;        MessageBox(NULL, L"ERROR Invalid RTP Socket", L"UDP Socket", MB_OK | MB_ICONERROR);&#xA;        return 0;&#xA;    }&#xA;&#xA;    int option = 12000;&#xA;    if (setsockopt(RTPSocket, SOL_SOCKET, SO_RCVBUF, (char*)&amp;option, sizeof(option)) &lt; 0)&#xA;    {&#xA;        printf("setsockopt failed\n");&#xA;&#xA;    }&#xA;&#xA;    /*option = TRUE;&#xA;    if (setsockopt(RTPSocket, SOL_SOCKET, SO_CONDITIONAL_ACCEPT, (char*)&amp;option, sizeof(option)) &lt; 0)&#xA;    {&#xA;        printf("setsockopt failed\n");&#xA;&#xA;    }*/&#xA;&#xA;    if (bind(RTPSocket, (sockaddr*)&amp;RTPSocketAddr, sizeof(RTPSocketAddr)) == SOCKET_ERROR)&#xA;    {&#xA;        MessageBox(NULL, L"ERROR bind", L"UDP Socket", MB_OK | MB_ICONERROR);&#xA;        closesocket(RTPSocket);&#xA;        return 0;&#xA;    }&#xA;    return 1;&#xA;}&#xA;&#xA;//------------------------------------------------------------------------------&#xA;char RTPSocketRecive(void)&#xA;{&#xA;    static char RecvBuf[2000];&#xA;    static int BufLen = 2000;&#xA;&#xA;    int iResult = 0;&#xA;    struct sockaddr_in SenderAddr;&#xA;    int SenderAddrSize = sizeof(SenderAddr);&#xA;    TCHAR szErrorMsg[100];&#xA;&#xA;    iResult = recvfrom(RTPSocket, RecvBuf, BufLen, 0, NULL, NULL);&#xA;    if (iResult == SOCKET_ERROR &amp;&amp; FlagRTPActive == TRUE)&#xA;    {&#xA;        StringCchPrintf(szErrorMsg, 100, L"ERROR recvfrom Ошибка:%d", WSAGetLastError());&#xA;        MessageBox(NULL, szErrorMsg, L"UDP Socket", MB_OK | MB_ICONERROR);&#xA;        return -1;&#xA;    }&#xA;&#xA;    packet.data = (unsigned char*)RecvBuf;&#xA;    packet.size = iResult;&#xA;&#xA;    return 1;&#xA;}&#xA;&#xA;//------------------------------------------------------------------------------&#xA;void RTPPacketParser(void)&#xA;{&#xA;    RTPHeader_DType RTPHeader;&#xA;    RTPData_DType NALU;&#xA;    unsigned char* buffer = packet.data;&#xA;    int pos = 0;&#xA;    static int count = 0;&#xA;    static short lastSequenceNumber = 0xFFFF;&#xA;    short type;&#xA;    char payload_header;&#xA;&#xA;    //read rtp header&#xA;    memcpy(&amp;RTPHeader, buffer, sizeof(RTPHeader));&#xA;    RTPHeader.sequence_number = BYTE2_SWAP(RTPHeader.sequence_number);&#xA;    pos &#x2B;= 12;    &#xA;  &#xA;    if (RTPHeader.X) {&#xA;        //profile extension&#xA;        short define;&#xA;        short length;&#xA;        length = buffer[pos &#x2B; 3];//suppose not so long extension&#xA;        pos &#x2B;= 4;&#xA;        pos &#x2B;= (length * 4);&#xA;    }&#xA;&#xA;    payload_header = buffer[pos];&#xA;    type = payload_header &amp; 0x1f; //Тип полезной нагрузки RTP&#xA;    pos&#x2B;&#x2B;;&#xA;    &#xA;    //STAP-A&#xA;    if (type == 24)&#xA;    {        &#xA;        while (pos &lt; packet.size)&#xA;        {&#xA;            unsigned short NALU_size;&#xA;            memcpy(&amp;NALU_size, buffer &#x2B; pos, 2);&#xA;            NALU_size = BYTE2_SWAP(NALU_size);&#xA;            pos &#x2B;= 2;&#xA;            char NAL_header = buffer[pos];&#xA;            short NAL_type = NAL_header &amp; 0x1f;&#xA;&#xA;            if (NAL_type == 7) &#xA;            {&#xA;                count&#x2B;&#x2B;;&#xA;                //cout&lt;&lt;"SPS, sequence number: "&lt;/cout&lt;&lt;"PPS, sequence number: "&lt;/cout&lt;&lt;"end of sequence, sequence number: "&lt; 0) &#xA;            {&#xA;                NALU.data = (unsigned char*) malloc(NALU_size &#x2B; 4);&#xA;                NALU.size = NALU_size &#x2B; 4;&#xA;                memcpy(NALU.data, &amp;inteval, 4);&#xA;                memcpy(NALU.data &#x2B; 4, &amp;buffer[pos], NALU_size);&#xA;&#xA;                WaitForSingleObject(hMutexRTPRecive, INFINITE);&#xA;                q.push(NALU);&#xA;                ReleaseMutex(hMutexRTPRecive);&#xA;            }&#xA;&#xA;            pos &#x2B;= NALU_size;&#xA;        }&#xA;    }&#xA;    //FU-A Fragmentation unit&#xA;    else if (type == 28)&#xA;    {        &#xA;        //FU header&#xA;        char FU_header = buffer[pos];&#xA;        bool fStart = FU_header &amp; 0x80;&#xA;        bool fEnd = FU_header &amp; 0x40;&#xA;&#xA;        //NAL header&#xA;        char NAL_header = (payload_header &amp; 0xe0) | (FU_header &amp; 0x1f);&#xA;        short NAL_type = FU_header &amp; 0x1f;&#xA;        if (NAL_type == 7) &#xA;        {&#xA;            count&#x2B;&#x2B;;&#xA;            //SPS&#xA;        }&#xA;        else if (NAL_type == 8) &#xA;        {&#xA;            //PPS&#xA;        }&#xA;        else if (NAL_type == 10) &#xA;        {&#xA;            //end of sequence&#xA;        }&#xA;        pos&#x2B;&#x2B;;&#xA;&#xA;        int size = packet.size - pos;&#xA;        &#xA;        if (count > 0)&#xA;        {&#xA;            if (fStart) &#xA;            {&#xA;                if (FU_buffer.size != 0)&#xA;                {&#xA;                    free(FU_buffer.data);&#xA;                    FU_buffer.size = 0;&#xA;                }&#xA;                FU_buffer.data = (unsigned char*)malloc(size &#x2B; 5);&#xA;                if (FU_buffer.data == NULL)&#xA;                    return;&#xA;                FU_buffer.size = size &#x2B; 5;&#xA;                memcpy(FU_buffer.data, &amp;inteval, 4);&#xA;                memcpy(FU_buffer.data &#x2B; 4, &amp;NAL_header, 1);&#xA;                memcpy(FU_buffer.data &#x2B; 5, buffer &#x2B; pos, size);&#xA;            }&#xA;            else&#xA;            {&#xA;                unsigned char* temp = (unsigned char*)malloc(FU_buffer.size &#x2B; size);&#xA;                memcpy(temp, FU_buffer.data, FU_buffer.size);&#xA;                memcpy(temp &#x2B; FU_buffer.size, buffer &#x2B; pos, size);&#xA;                if (FU_buffer.size != 0) free(FU_buffer.data);&#xA;                FU_buffer.data = temp;&#xA;                FU_buffer.size &#x2B;= size;&#xA;            }&#xA;&#xA;            if (fEnd)&#xA;            {&#xA;                NALU.data = (unsigned char*)malloc(FU_buffer.size);&#xA;                NALU.size = FU_buffer.size;&#xA;                memcpy(NALU.data, FU_buffer.data, FU_buffer.size);&#xA;&#xA;                WaitForSingleObject(hMutexRTPRecive, INFINITE);&#xA;                q.push(NALU);&#xA;                ReleaseMutex(hMutexRTPRecive);&#xA;&#xA;                free(FU_buffer.data);&#xA;                FU_buffer.size = 0;&#xA;            }&#xA;        }&#xA;        &#xA;    }&#xA;    else &#xA;    {&#xA;        //other type&#xA;        short NAL_type = type;&#xA;        if (NAL_type == 7) &#xA;        {&#xA;            count&#x2B;&#x2B;;&#xA;            //SPS&#xA;        }&#xA;        else if (NAL_type == 8) &#xA;        {&#xA;            //PPS&#xA;        }&#xA;        else if (NAL_type == 10) &#xA;        {&#xA;            //end of sequence&#xA;        }&#xA;&#xA;        int size = packet.size - pos &#x2B; 1;&#xA;        if (count > 0)&#xA;        {&#xA;            NALU.data = (unsigned char*)malloc(size&#x2B;4);&#xA;            NALU.size = size &#x2B; 4;&#xA;            memcpy(NALU.data, &amp;inteval, 4);&#xA;            memcpy(NALU.data &#x2B; 4, &amp;buffer[12], size);&#xA;&#xA;            WaitForSingleObject(hMutexRTPRecive, INFINITE);&#xA;            q.push(NALU);&#xA;            ReleaseMutex(hMutexRTPRecive);&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;//------------------------------------------------------------------------------&#xA;void Decode_NaluToAVFrameRGG()&#xA;{&#xA;    unsigned char cntNALU;&#xA;    int len = 0;&#xA;    static int size = 0;&#xA;    unsigned char* data = NULL;&#xA;    int ret;&#xA;    RTPData_DType NALU;&#xA;&#xA;    av_frame_unref(pAVFrame);&#xA;    av_packet_unref(pAVPacket);&#xA;&#xA;    while(1)&#xA;    {&#xA;        WaitForSingleObject(hMutexRTPRecive, INFINITE);&#xA;        if (q.empty())&#xA;        {&#xA;            ReleaseMutex(hMutexRTPRecive);&#xA;            break;&#xA;        }&#xA;        NALU = q.front();&#xA;        q.pop();&#xA;        ReleaseMutex(hMutexRTPRecive);&#xA;&#xA;        data = NALU.data;&#xA;        size = NALU.size;&#xA;&#xA;        while(size)&#xA;        {            &#xA;            len = av_parser_parse2(pAVCodecParserContext, pAVCodecContext, &amp;pAVPacket->data, &amp;pAVPacket->size,&#xA;                (uint8_t*)data, size,&#xA;                AV_NOPTS_VALUE, AV_NOPTS_VALUE, AV_NOPTS_VALUE);&#xA;&#xA;            data = len ? data &#x2B; len : data;&#xA;            size -= len;&#xA;            &#xA;            if (pAVPacket->size)&#xA;            {&#xA;                ret = avcodec_send_packet(pAVCodecContext, pAVPacket);&#xA;&#xA;                if(ret == AVERROR_EOF)&#xA;                    MessageBox(NULL, L"the codec has been fully flushed, and there will be no more output frames", L"avcodec_send_packet", MB_OK | MB_ICONERROR);&#xA;&#xA;                if (ret &lt; 0)&#xA;                {&#xA;                    MessageBox(NULL, L"ERROR sending a packet for decoding", L"Decode", MB_OK | MB_ICONERROR);&#xA;                    //exit(1);&#xA;                }&#xA;&#xA;                while (ret >= 0) &#xA;                {&#xA;                    ret = avcodec_receive_frame(pAVCodecContext, pAVFrame);&#xA;                    if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)&#xA;                        break;&#xA;                    else if (ret &lt; 0) {&#xA;                        MessageBox(NULL, L"ERROR during decoding", L"Decode", MB_OK | MB_ICONERROR);&#xA;                        //exit(1);&#xA;                    }&#xA;                    &#xA;                    AVFrameRGG = av_frame_alloc();                                       &#xA;                    pSwsContext = sws_getContext(pAVCodecContext->width, pAVCodecContext->height, pAVCodecContext->pix_fmt,&#xA;                        pAVCodecContext->width, pAVCodecContext->height, AV_PIX_FMT_RGB24, SWS_SPLINE,&#xA;                        0, 0, 0);&#xA;&#xA;                    sws_scale_frame(pSwsContext, AVFrameRGG, pAVFrame);&#xA;                                        &#xA;                    ImgBufferSet(AVFrameRGG->data[0], pAVCodecContext->height, pAVCodecContext->width, AVFrameRGG->linesize[0]);&#xA;&#xA;                    sws_freeContext(pSwsContext);&#xA;                    av_frame_free(&amp;AVFrameRGG);&#xA;                }&#xA;            }&#xA;        }&#xA;        free(NALU.data);&#xA;        NALU.size = 0;&#xA;    }    &#xA;}&#xA;&#xA;</int></queue></iostream></chrono>

    &#xA;

    It's DECIDED

    &#xA;

  • Understanding Data Processing Agreements and How They Affect GDPR Compliance

    9 octobre 2023, par Erin — GDPR

    The General Data Protection Regulation (GDPR) impacts international organisations that conduct business or handle personal data in the European Union (EU), and they must know how to stay compliant.

    One way of ensuring GDPR compliance is through implementing a data processing agreement (DPA). Most businesses overlook DPAs when considering ways of maintaining user data security. So, what exactly is a DPA’s role in ensuring GDPR compliance ?

    In this article, we’ll discuss DPAs, their advantages, which data protection laws require them and the clauses that make up a DPA. We’ll also discuss the consequences of non-compliance and how you can maintain GDPR compliance using Matomo.

    What is a data processing agreement ?

    A data processing agreement, data protection agreement or data processing addendum is a contractual agreement between a data controller (a company) and a data processor (a third-party service provider.) It defines each party’s rights and obligations regarding data protection.

    A DPA also defines the responsibilities of the controller and the processor and sets out the terms they’ll use for data processing. For instance, when MHP/Team SI sought the services of Matomo (a data processor) to get reliable and compliant web analytics, a DPA helped to outline their responsibilities and liabilities.

    A DPA is one of the basic requirements for GDPR compliance. The GDPR is an EU regulation concerning personal data protection and security. The GDPR is binding on any company that actively collects data from EU residents or citizens, regardless of their location.

    As a business, you need to know what goes into a DPA to identify possible liabilities that may arise if you don’t comply with European data protection laws. For example, having a recurrent security incident can lead to data breaches as you process customer personal data.

    The average data breach cost for 2023 is $4.45 million. This amount includes regulatory fines, containment costs and business losses. As such, a DPA can help you assess the organisational security measures of your data processing methods and define the protocol for reporting a data breach.

    Why is a DPA essential for your business ?

    If your company processes personal data from your customers, such as contact details, you need a DPA to ensure compliance with data security laws like GDPR. You’ll also need a DPA to hire a third party to process your data, e.g., through web analytics or cloud storage.

    But what are the benefits of having a DPA in place ?

    Benefits of a data processing agreement

    A key benefit of signing a DPA is it outlines business terms with a third-party data processor and guarantees compliance with the relevant data privacy laws. A DPA also helps to create an accountability framework between you and your data processor by establishing contractual obligations.

    Additionally, a DPA helps to minimise the risk of unauthorised access to sensitive data. A DPA defines organisational measures that help protect the rights of individuals and safeguard personal data against unauthorised disclosure. Overall, before choosing a data processor, having a DPA ensures that they are capable, compliant and qualified.

    More than 120 countries have already adopted some form of international data protection laws to protect their citizens and their data better. Hence, knowing which laws require a DPA and how you can better ensure compliance is important.

    Which data protection laws require a DPA ?

    Regulatory bodies enact data protection laws to grant consumers greater control over their data and how businesses use it. These laws ensure transparency in data processing and compliance for businesses.

    Data protection laws that require a DPA

    The following are some of the relevant data privacy laws that require you to have a DPA :

    • UK GDPR
    • Brazil LGPD
    • EU GDPR
    • Dubai PDPA
    • Colorado CPA
    • California CCPA/CPRA
    • Virginia VCDPA
    • Connecticut DPA
    • South African POPIA
    • Thailand PDPA

    Companies that don’t adhere to these data protection obligations usually face liabilities such as fines and penalties. With a DPA, you can set clear expectations regarding data processing between you and your customers.

    Review and update any DPAs with third-party processors to ensure compliance with GDPR and the laws we mentioned above. Additionally, confirm that all the relevant clauses are present for compliance with relevant data privacy laws. 

    So, what key data processing clauses should you have in your DPA ? Let’s take a closer look in the next section.

    Key clauses in a data processing agreement

    GDPR provides some general recommendations for what you should state in a DPA.

    Key elements found in a DPA

    Here are the elements you should include :

    Data processing specifications

    Your DPA should address the specific business purposes for data processing, the duration of processing and the categories of data under processing. It should also clearly state the party responsible for maintaining GDPR compliance and who the data subjects are, including their location and nationality.

    Your DPA should also address the data processor and controller’s responsibilities concerning data deletion and contract termination.

    Role of processor

    Your DPA should clearly state what your data processor is responsible for and liable for. Some key responsibilities include record keeping, reporting breaches and maintaining data security.

    Other roles of your data processor include providing you with audit opportunities and cooperating with data protection authorities during inquiries. If you decide to end your contract, the data processor is responsible for deleting or returning data, depending on your agreement.

    Role of controller

    Your DPA should inform the responsibilities of the data controller, which typically include issuing processing instructions to the data processor and directing them on how to handle data processing.

    Your DPA should let you define the lawful data processes the data processor should follow and how you’ll uphold the data protection rights of individuals’ sensitive data.

    Organisational and technical specifications

    Your DPA should define specifications such as how third-party processors encrypt, access and test personal data. It should also include specifications on how the data processor and controller will maintain ongoing data security through various factors such as :

    • State of the technology : Do ‌third-party processors have reliable technology, and can they ensure data security within their systems ?
    • Costs of implementation : Does the data controller’s budget allow them to seek third-party services from industry-leading providers who can guarantee a certain level of security ?
    • Variances in users’ personal freedom : Are there privacy policies and opt-out forms for users to express how they want companies to use their sensitive data ?

    Moreover, your DPA should define how you and your data processor will ensure the confidentiality, availability and integrity of data processing services and systems.

    What are the penalties for DPA GDPR non-compliance ?

    Regulators use GDPR’s stiff fines to encourage data controllers and third-party processors to follow‌ best data security practices. One way of maintaining compliance is through drafting up a DPA with your data processor.

    The DPA should clearly outline the necessary legal requirements and include all the relevant clauses mentioned above. Understand what goes into this agreement since data protection authorities can hold your business accountable for a breach — even if a processor’s error caused it.

    Data protection authorities can issue penalties now that the GDPR is in place. For example, according to Article 83 of the GDPR, penalties for data or privacy breaches or non-compliance can amount to up to €20 million or 4% of your annual revenue.

    There are two tiers of fines : tier one and tier two. Violations related to data processors typically attract fines on the tier-one level. Tier one fines can cost your business €10 million or 2% of your company’s global revenue.

    Tier-two fines result from infringement of the right to forget and the right to privacy of your consumer. Tier-two fines can cost your business up to €20 million or 4% of your company’s global revenue.

    GDPR fines make non-compliance an expensive mistake for businesses of all sizes. As such, signing a DPA with any party that acts as a data processor for your business can help you remain GDPR-compliant.

    How a DPA can help your business remain GDPR compliant

    A DPA can help your business define and adhere to lawful data processes.

    Steps to take to be DPA GDPR compliant

    So, in what other ways can a DPA help you to remain compliant with GDPR ? Let’s take a look !

    1. Assess data processor’s compliance

    Having a DPA helps ensure that the data processor you are working with is GDPR-compliant. You should check if they have a DPA and confirm the processor’s terms of service and legal basis.

    For example, if you want an alternative to Google Analytics that’s GDPR compliant, then you can opt for Matomo. Matomo features a DPA, which you can agree to when you sign up for web analytics services or later.

    2. Establish lawful data processes

    A DPA can also help you review your data processes to ensure they’re GDPR compliant. For example, by defining lawful data processes, you better understand personally identifiable information (PII) and how it relates to data privacy.

    Further, you can allow users to opt out of sharing their data. As such, Matomo can help you to enable Do Not Track preferences on your website.

    With this feature, users are given the option to opt in or out of tracking via a toggle in their respective browsers.

    Indeed, establishing lawful data processes helps you define the specific business purposes for collecting and processing personal data. By doing so, you get to notify your users why you need their data and get their consent to process it by including a GDPR-compliant privacy policy on your website.

    3. Anonymise your data

    Global privacy laws like GDPR and ePrivacy mandate companies to display cookie banners or seek consent before tracking visitors’ data. You can either include a cookie consent banner on your site or stop tracking cookies to follow the applicable regulations.

    Further, you can enable cookie-less tracking or easily let users opt out. For example, you can use Matomo without a cookie consent banner, exempting it from many countries’ privacy rules.

    Additionally, through a DPA, you can define organisational measures that define how you’ll anonymise all your users’ data. Matomo can help you anonymise IP addresses, and we recommend that you at least anonymise the last two bytes.

    As one of the few web analytics tools you can use to collect data without tracking consent, Matomo also has the French Data Protection Authority (CNIL) approval.

    4. Assess the processor’s bandwidth

    Having a DPA can help you implement data retention policies that show clear retention periods. Such policies are useful when ending a contract with a third-party service provider and determining how they should handle your data.

    A DPA also helps you ensure the processor has the necessary technology to store personal data securely. You can conduct an audit to understand possible vulnerabilities and your data processor’s technological capacity.

    5. Obtain legal counsel

    When drafting a DPA, it’s important to get a consultation on what is needed to ensure complete compliance. Obtaining legal counsel points you in the right direction so you don’t make any mistakes that may lead to non-compliance.

    Conclusion

    Businesses that process users’ data are subject to several DPA contract requirements under GDPR. One of the most important is having DPAs with every third-party provider that helps them perform data processing.

    It’s important to stay updated on GDPR requirements for compliance. As such, Matomo can help you maintain lawful data processes. Matomo gives you complete control over your data and complies with GDPR requirements.

    To get started with Matomo, you can sign up for a 21-day free trial. No credit card required.

    Disclaimer

    We are not lawyers and don’t claim to be. The information provided here is to help give an introduction to GDPR. We encourage every business and website to take data privacy seriously and discuss these issues with your lawyer if you have any concerns.

  • Server Move For multimedia.cx

    1er août 2014, par Multimedia Mike — General

    I made a big change to multimedia.cx last week : I moved hosting from a shared web hosting plan that I had been using for 10 years to a dedicated virtual private server (VPS). In short, I now have no one to blame but myself for any server problems I experience from here on out.

    The tipping point occurred a few months ago when my game music search engine kept breaking regardless of what technology I was using. First, I had an admittedly odd C-based CGI solution which broke due to mysterious binary compatibility issues, the sort that are bound to occur when trying to make a Linux binary run on heterogeneous distributions. The second solution was an SQLite-based solution. Like the first solution, this worked great until it didn’t work anymore. Something else mysteriously broke vis-à-vis PHP and SQLite on my server. I started investigating a MySQL-based full text search solution but couldn’t make it work, and decided that I shouldn’t have to either.

    Ironically, just before I finished this entire move operation, I noticed that my SQLite-based FTS solution was working again on the old shared host. I’m not sure when that problem went away. No matter, I had already thrown the switch.

    How Hard Could It Be ?
    We all have thresholds for the type of chores we’re willing to put up with and which we’d rather pay someone else to perform. For the past 10 years, I felt that administering a website’s underlying software is something that I would rather pay someone else to worry about. To be fair, 10 years ago, I don’t think VPSs were a thing, or at least a viable thing in the consumer space, and I wouldn’t have been competent enough to properly administer one. Though I would have been a full-time Linux user for 5 years at that point, I was still the type to build all of my own packages from source (I may have still been running Linux From Scratch 10 years ago) which might not be the most tractable solution for server stability.

    These days, VPSs are a much more affordable option (easily competitive with shared web hosting). I also realized I know exactly how to install and configure all the software that runs the main components of the various multimedia.cx sites, having done it on local setups just to ensure that my automated backups would actually be useful in the event of catastrophe.

    All I needed was the will to do it.

    The Switchover Process
    Here’s the rough plan :

    • Investigate options for both VPS providers and mail hosts– I might be willing to run a web server but NOT a mail server
    • Start plotting several months in advance of my yearly shared hosting renewal date
    • Screw around for several months, playing video games and generally finding reasons to put off the move
    • Panic when realizing there are only a few days left before the yearly renewal comes due

    So that’s the planning phase. BTW, I chose Digital Ocean for VPS and Zoho for email hosting. Here’s the execution phase I did last week :

    • Register with Digital Ocean and set up DNS entries to point to the old shared host for the time being
    • Once the D-O DNS servers respond correctly using a manual ‘dig’ command, use their servers as the authoritative ones for multimedia.cx
    • Create a new Droplet (D-O VPS), install all the right software, move the databases, upload the files ; and exhaustively document each step, gotcha, and pitfall ; treat a VPS as necessarily disposable and have an eye towards iterating the process with a new VPS
    • Use /etc/hosts on a local machine to point DNS to the new server and verify that each site is working correctly
    • After everything looks all right, update the DNS records to point to the new server

    Finally, flip the switch on the MX record by pointing it to the new email provider.

    Improvements and Problems
    Hosting on Digital Ocean is quite amazing so far. Maybe it’s the SSDs. Whatever it is, all the sites are performing far better than on the old shared web host. People who edit the MultimediaWiki report that changes get saved in less than the 10 or so seconds required on the old server.

    Again, all problems are now my problems. A sore spot with the shared web host was general poor performance. The hosting company would sometimes complain that my sites were using too much CPU. I would have loved to try to optimize things. However, the cPanel interface found on many shared hosts don’t give you a great deal of data for debugging performance problems. However, same sites, same software, same load on the VPS is considerably more performant.

    Problem : I’ve already had the MySQL database die due to a spike in usage. I had to manually restart it. I was considering a cron-based solution to check if the server is running and restart it if not. In response to my analysis that my databases are mostly read and not often modified, so db crashes shouldn’t be too disastrous, a friend helpfully reminded me that, “You would not make a good sysadmin with attitudes like ‘an occasional crash is okay’.”

    To this end, I am planning to migrate the database server to a separate VPS. This is a strategy that even Digital Ocean recommends. I’m hoping that the MySQL server isn’t subject to such memory spikes, but I’ll continue to monitor it after I set it up.

    Overall, the server continues to get modest amounts of traffic. I predict it will remain that way unless Dark Shikari resurrects the x264dev blog. The biggest spike that multimedia.cx ever saw was when Steve Jobs linked to this WebM post.

    Dropped Sites
    There are a bunch of subdomains I dropped because I hadn’t done anything with them for years and I doubt anyone will notice they’re gone. One notable section that I decided to drop is the samples.mplayerhq.hu archive. It will live on, but it will be hosted by samples.ffmpeg.org, which had a full mirror anyway. The lower-end VPS instances don’t have the 53 GB necessary.

    Going Forward
    Here’s to another 10 years of multimedia.cx, even if multimedia isn’t as exciting as it was 10 years ago (personal opinion ; I’ll have another post on this later). But at least I can get working on some other projects now that this is done. For the past 4 months or so, whenever I think of doing some other project, I always remembered that this server move took priority over everything else.