c ++队列Pop():引发异常:读取访问冲突。 m为nullptr

时间:2020-06-16 07:00:52

标签: c++ queue buffer deque

数据填充没有问题。但是在执行了2-3次弹出操作后,我抛出了异常:读取访问冲突m为nullptr错误。您认为是什么原因?

    #define bufferSize 60   
    Mat frame1Current;
    vector<Mat> colorImages(4); 
    deque<Mat> frameQueue9001;

        Mat returnImage;

        string gst_pipe[] = {
        "udpsrc port=9001 caps = application/x-rtp ! rtph264depay ! h264parse ! nvh264dec ! videoconvert ! appsink sync=false"};

        void func1() {
            videoCap[0] = VideoCapture(gst_pipe[0], CAP_GSTREAMER);

            colorImages[0].create(Size(rsSplitWidth, rsSplitHeight), CV_8UC3);
            int i = 0;
            while (true)
            {
                videoCap[0].read(frame1Current);
                frameQueue9001.push_back(frame1Current.clone());

                if (frameQueue9001.size() > bufferSize)
                {
                    colorImages[0] = frameQueue9001.front();
                    frameQueue9001.pop_front();
                    checker9001 = true;
                    i++;
                }
            }
        }

0 个答案:

没有答案