houxiao
2017-07-20 5f5e870de69efe56d571a2c93362942af5bb49a5
restart

git-svn-id: http://192.168.1.226/svn/proxy@764 454eff88-639b-444f-9e54-f578c98de674
6个文件已修改
450 ■■■■■ 已修改文件
RtspFace/PL_AndroidMediaCodecDecoder_ndk.cpp 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PL_RTSPClient.cpp 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PL_RTSPClient.h 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PL_SensetimeFaceTrack.cpp 278 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PipeLine.cpp 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PipeLine.h 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PL_AndroidMediaCodecDecoder_ndk.cpp
@@ -172,8 +172,11 @@
void PL_AndroidMediaCodecDecoder::finit()
{
    PL_AMCD_Internal* in = (PL_AMCD_Internal*)internal;
    //todo release codec
    // call AMediaCodec_stop
    AMediaCodec_stop(in->codec);
    AMediaCodec_delete(in->codec);
    in->reset();
}
bool PL_AndroidMediaCodecDecoder::pay(const PipeMaterial& pm)
RtspFace/PL_RTSPClient.cpp
@@ -32,12 +32,14 @@
    MB_Frame lastFrame;
    RtspClientParam lastParam;
    volatile bool killed;
    RTSPClient_Internal() : 
        rtspConfig(), live_daemon_thid(0), 
        eventLoopWatchVariable(0), live_daemon_running(false), 
        frame_mutex(new pthread_mutex_t), continue_mutex(new pthread_mutex_t), 
        lastFrame(), lastParam()
        lastFrame(), lastParam(), killed(false)
    {
        pthread_mutex_init(frame_mutex, NULL);
        pthread_mutex_init(continue_mutex, NULL);
@@ -167,7 +169,13 @@
    RTSPClient_Internal* in = (RTSPClient_Internal*)internal;
    
    in->eventLoopWatchVariable = 1;
    pthread_mutex_unlock(in->continue_mutex);
    pthread_mutex_unlock(in->frame_mutex);
    pthread_join(in->live_daemon_thid, NULL);
    in->reset();
}
bool PL_RTSPClient::pay(const PipeMaterial& pm)
@@ -187,19 +195,38 @@
        return false;
    }
    if (in->killed)
    {
        LOGP(WARN, "killed 1");
        return false;
    }
    ret = pthread_mutex_lock(in->frame_mutex);
    if(ret != 0)
    {
        LOGP(ERROR, "pthread_mutex_lock: %s/n", strerror(ret));
        return false;
    }
    if (in->killed)
    {
        LOGP(WARN, "killed 2");
        return false;
    }
    pm.type = PipeMaterial::PMT_FRAME;
    pm.buffer = &(in->lastFrame);
    pm.buffSize = 0;
    pm.former = this;
    return true;
}
void PL_RTSPClient::kill()
{
    RTSPClient_Internal* in = (RTSPClient_Internal*)internal;
    in->killed = true;
    pthread_mutex_unlock(in->frame_mutex);
}
void rtsp_client_set_param_callback(void* arg, RtspClientParam& param)
@@ -222,30 +249,30 @@
    sprintf(tmp, "%u", param.height); client->manager->set_param(PLGP_RTSP_HEIGHT, std::string(tmp));
    sprintf(tmp, "%u", param.fps); client->manager->set_param(PLGP_RTSP_FPS, std::string(tmp));
    /*
    std::string fmtp(client->manager->get_param(PLGP_RTSP_FMTP));
    if (fmtp.empty())
        return ;
    /*
    std::string fmtp(client->manager->get_param(PLGP_RTSP_FMTP));
    if (fmtp.empty())
        return ;
    uint32_t numSPropRecords = 0;
    SPropRecord *p_record = parseSPropParameterSets(fmtp.c_str(), numSPropRecords);
    if (numSPropRecords < 2)
    {
        LOG_WARN << "numSPropRecords < 2" << std::endl;
        return ;
    }
    uint32_t numSPropRecords = 0;
    SPropRecord *p_record = parseSPropParameterSets(fmtp.c_str(), numSPropRecords);
    if (numSPropRecords < 2)
    {
        LOG_WARN << "numSPropRecords < 2" << std::endl;
        return ;
    }
    SPropRecord &sps = p_record[0];
    SPropRecord &pps = p_record[1];
    SPropRecord &sps = p_record[0];
    SPropRecord &pps = p_record[1];
    LOG_INFO << "sps.sPropLength" << sps.sPropLength << LOG_ENDL;
    for (int i = 0; i < sps.sPropLength; i++)
        LOGP(INFO, "0x%02X ", (int)sps.sPropBytes[i]);
    LOG_INFO << "sps.sPropLength" << sps.sPropLength << LOG_ENDL;
    for (int i = 0; i < sps.sPropLength; i++)
        LOGP(INFO, "0x%02X ", (int)sps.sPropBytes[i]);
    
    LOG_INFO << "pps.sPropLength" << pps.sPropLength << LOG_ENDL;
    for (int i = 0; i < pps.sPropLength; i++)
        LOGP(INFO, "0x%02X ", (int)pps.sPropBytes[i]);
    */
    LOG_INFO << "pps.sPropLength" << pps.sPropLength << LOG_ENDL;
    for (int i = 0; i < pps.sPropLength; i++)
        LOGP(INFO, "0x%02X ", (int)pps.sPropBytes[i]);
    */
}
void rtsp_client_frame_callback(void* arg, uint8_t* buffer, size_t buffSize, timeval presentationTime)
@@ -281,6 +308,6 @@
    int ret = pthread_mutex_lock(in->continue_mutex);
    if(ret != 0)
    {
        LOG_ERROR << "pthread_mutex_unlock continue_mutex: " << strerror(ret) << std::endl;
        LOG_ERROR << "pthread_mutex_lock continue_mutex: " << strerror(ret) << std::endl;
    }
}
RtspFace/PL_RTSPClient.h
@@ -39,6 +39,9 @@
    virtual bool pay(const PipeMaterial& pm);
    virtual bool gain(PipeMaterial& pm);
    // kill locks internal
    void kill();
    
private:
    void* internal;
RtspFace/PL_SensetimeFaceTrack.cpp
@@ -81,46 +81,46 @@
#ifdef __ANDROID__
    {
        bool retLic = false;
        if (in->config.license_str.empty())
        {
            if (in->config.license_file_path.empty())
                in->config.license_file_path = "/data/license.lic";
        if (in->config.license_str.empty())
        {
            if (in->config.license_file_path.empty())
                in->config.license_file_path = "/data/license.lic";
            FILE * licFile = fopen (in->config.license_file_path.c_str(),"rb");
            if (licFile != nullptr)
            {
                char licBuffer[1025 * 5] = {'\0'};
                size_t licSize = fread(licBuffer, sizeof(uint8_t), sizeof(licBuffer), licFile);
                fclose (licFile);
            FILE * licFile = fopen (in->config.license_file_path.c_str(),"rb");
            if (licFile != nullptr)
            {
                char licBuffer[1025 * 5] = {'\0'};
                size_t licSize = fread(licBuffer, sizeof(uint8_t), sizeof(licBuffer), licFile);
                fclose (licFile);
                if (licSize > 0)
                {
                    int ret = cv_face_init_license_config(licBuffer);
                    LOG_INFO << "cv_face_init_license_config 1 ret=" << ret << LOG_ENDL;
                    retLic = true;
                }
            }
            else
            {
                LOG_WARN << "cv_face_init_license_config 2 errno=" << errno << LOG_ENDL;
            }
        }
        else
        {
            int ret = cv_face_init_license_config(in->config.license_str.c_str());
            LOG_INFO << "cv_face_init_license_config 3 ret=" << ret << LOG_ENDL;
            retLic = true;
        }
                if (licSize > 0)
                {
                    int ret = cv_face_init_license_config(licBuffer);
                    LOG_INFO << "cv_face_init_license_config 1 ret=" << ret << LOG_ENDL;
                    retLic = true;
                }
            }
            else
            {
                LOG_WARN << "cv_face_init_license_config 2 errno=" << errno << LOG_ENDL;
            }
        }
        else
        {
            int ret = cv_face_init_license_config(in->config.license_str.c_str());
            LOG_INFO << "cv_face_init_license_config 3 ret=" << ret << LOG_ENDL;
            retLic = true;
        }
        //int ret = cv_face_init_license_config(_lic);
        //LOG_INFO << "cv_face_init_license_config 3 ret=" << ret << LOG_ENDL;
        //retLic = true;
        //int ret = cv_face_init_license_config(_lic);
        //LOG_INFO << "cv_face_init_license_config 3 ret=" << ret << LOG_ENDL;
        //retLic = true;
        if (!retLic)
        {
            LOG_WARN << "stface for android no license" << LOG_ENDL;
            return false;
        }
        {
            LOG_WARN << "stface for android no license" << LOG_ENDL;
            return false;
        }
    }
#endif
    
@@ -141,8 +141,8 @@
    //in->config.generate_face_point = true;
    //in->config.draw_face_feature_point = true;
    // if not use CV_FACE_TRACKING_TWO_THREAD, stfacesdk detect face per 20 frame and light flow tracking interval
    // per detect in RK3288: 800ms@1920w,200ms@640w; with CV_FACE_TRACKING_TWO_THREAD 10ms@1920w
    // if not use CV_FACE_TRACKING_TWO_THREAD, stfacesdk detect face per 20 frame and light flow tracking interval
    // per detect in RK3288: 800ms@1920w,200ms@640w; with CV_FACE_TRACKING_TWO_THREAD 10ms@1920w
    // init handle
    cv_result_t cv_result = cv_face_create_tracker(&(in->handle_track), nullptr, 
@@ -173,45 +173,47 @@
    // destroy track handle
    cv_face_destroy_tracker(in->handle_track);
    in->handle_track = nullptr;
    in->reset();
}
static void test_dump_feature(cv_face_t* p_face, int face_count)
{
    static std::fstream dumpfile("/data/temp/dump-106-photo2.txt", std::ios_base::out | std::ios_base::trunc);
    static std::fstream dumpfile("/data/temp/dump-106-photo2.txt", std::ios_base::out | std::ios_base::trunc);
    for (int i = 0; i < face_count; i++)
    {
        dumpfile << p_face[i].rect.left << "\t"
                 << p_face[i].rect.top << "\t"
                 << p_face[i].rect.right << "\t"
                 << p_face[i].rect.bottom << "\t";
    for (int i = 0; i < face_count; i++)
    {
        dumpfile << p_face[i].rect.left << "\t"
                 << p_face[i].rect.top << "\t"
                 << p_face[i].rect.right << "\t"
                 << p_face[i].rect.bottom << "\t";
        dumpfile << p_face[i].score << "\t"
                << p_face[i].points_count << "\t"
                << p_face[i].yaw << "\t"
                << p_face[i].pitch << "\t"
                << p_face[i].roll << "\t"
                << p_face[i].eye_dist << "\t"
                << p_face[i].ID << "\t";
        dumpfile << p_face[i].score << "\t"
                << p_face[i].points_count << "\t"
                << p_face[i].yaw << "\t"
                << p_face[i].pitch << "\t"
                << p_face[i].roll << "\t"
                << p_face[i].eye_dist << "\t"
                << p_face[i].ID << "\t";
        cv_pointf_t points_array[256];
        cv_pointf_t points_array[256];
        for (int j = 0; j < p_face[i].points_count; j++)
        {
            dumpfile << p_face[i].points_array[j].x << "\t"
                    << p_face[i].points_array[j].y << "\t";
        }
        for (int j = 0; j < p_face[i].points_count; j++)
        {
            dumpfile << p_face[i].points_array[j].x << "\t"
                    << p_face[i].points_array[j].y << "\t";
        }
        dumpfile << std::endl;
    }
        dumpfile << std::endl;
    }
}
int doFaceTrack(PL_SensetimeFaceTrack_Internal* in, 
                uint8_t* buffer, size_t width, size_t height, size_t stride, cv_pixel_format cvPixFmt)
{
    PipeLineElemTimingDebugger td(nullptr);
    //PipeLineElemTimingDebugger td(nullptr);
    if (in->config.doTrackPerFrame == 0)
    if (in->config.doTrackPerFrame == 0)
        return 0;
    if (in->frameCount % in->config.doTrackPerFrame != 0)
        return 0;
@@ -233,8 +235,8 @@
        return -1;
    }
    //#test
    //test_dump_feature(p_face, face_count);
    //#test
    //test_dump_feature(p_face, face_count);
#ifdef USE_OPENCV
    // draw the video
@@ -285,41 +287,41 @@
        }
#endif
        if (in->config.generate_face_point)
        {
            for (int j = 0; j < p_face[i].points_count; j++)
            {
                PLGH_Point featurePoint;
                featurePoint.X = p_face[i].points_array[j].x;
                featurePoint.Y = p_face[i].points_array[j].y;
                faceFeature.featurePoints.points.push_back(featurePoint);
        if (in->config.generate_face_point)
        {
            for (int j = 0; j < p_face[i].points_count; j++)
            {
                PLGH_Point featurePoint;
                featurePoint.X = p_face[i].points_array[j].x;
                featurePoint.Y = p_face[i].points_array[j].y;
                faceFeature.featurePoints.points.push_back(featurePoint);
#ifdef USE_OPENCV
                if (in->config.draw_face_feature_point)
                {
                    cv::circle(yMat, cv::Point2f(p_face[i].points_array[j].x, p_face[i].points_array[j].y), 1, cv::Scalar(255, 255, 255));
                }
                if (in->config.draw_face_feature_point)
                {
                    cv::circle(yMat, cv::Point2f(p_face[i].points_array[j].x, p_face[i].points_array[j].y), 1, cv::Scalar(255, 255, 255));
                }
#endif
            }
            }
            //int p46x = p_face[i].points_array[46].x;
            //int p46y = p_face[i].points_array[46].y;
            //int p6x = p_face[i].points_array[6].x;
            //int p6y = p_face[i].points_array[6].y;
            //double dist1 = std::sqrt((p46x-p6x)*(p46x-p6x)+(p46y-p6y)*(p46y-p6y));
            //int p46x = p_face[i].points_array[46].x;
            //int p46y = p_face[i].points_array[46].y;
            //int p6x = p_face[i].points_array[6].x;
            //int p6y = p_face[i].points_array[6].y;
            //double dist1 = std::sqrt((p46x-p6x)*(p46x-p6x)+(p46y-p6y)*(p46y-p6y));
            //int p43x = p_face[i].points_array[43].x;
            //int p43y = p_face[i].points_array[43].y;
            //int p2x = p_face[i].points_array[2].x;
            //int p2y = p_face[i].points_array[2].y;
            //double dist2 = std::sqrt((p43x-p2x)*(p43x-p2x)+(p43y-p2y)*(p43y-p2y));
            //int p43x = p_face[i].points_array[43].x;
            //int p43y = p_face[i].points_array[43].y;
            //int p2x = p_face[i].points_array[2].x;
            //int p2y = p_face[i].points_array[2].y;
            //double dist2 = std::sqrt((p43x-p2x)*(p43x-p2x)+(p43y-p2y)*(p43y-p2y));
            //LOGP(ERROR, "dist46_6/dist43_2=%f", dist1 / dist2);
        }
            //LOGP(ERROR, "dist46_6/dist43_2=%f", dist1 / dist2);
        }
        if (faceFeature.rect.leftTop.X < 0 || faceFeature.rect.rightBottom.X > width ||
                faceFeature.rect.leftTop.Y < 0 || faceFeature.rect.rightBottom.Y > height)
            faceFeature.outOfFrame = true;
        if (faceFeature.rect.leftTop.X < 0 || faceFeature.rect.rightBottom.X > width ||
                faceFeature.rect.leftTop.Y < 0 || faceFeature.rect.rightBottom.Y > height)
            faceFeature.outOfFrame = true;
        if (in->config.generate_face_feature)
        {
@@ -334,7 +336,7 @@
            // explode the range
            if (in->config.explode_feature_rect_x != 0)
            {
                faceFeature.rect.leftTop.X =     clamp(faceFeature.rect.leftTop.X - in->config.explode_feature_rect_x, 0,  faceFeature.rect.leftTop.X);
                faceFeature.rect.leftTop.X =     clamp(faceFeature.rect.leftTop.X - in->config.explode_feature_rect_x, 0,  faceFeature.rect.leftTop.X);
                faceFeature.rect.rightBottom.X = clamp(faceFeature.rect.rightBottom.X + in->config.explode_feature_rect_x, faceFeature.rect.rightBottom.X, int(width - 1));
            }
@@ -344,29 +346,29 @@
                faceFeature.rect.rightBottom.Y = clamp(faceFeature.rect.rightBottom.Y + in->config.explode_feature_rect_y, faceFeature.rect.rightBottom.Y, int(height - 1));
            }
            //f (in->config.clamp_feature_rect)
            //
            //   int dW = width - faceFeature.rect.width();
            //   if (dW < 0)
            //   {
            //       dW = std::abs(dW) / 2 + 1;
            //       faceFeature.rect.leftTop.x += dW;
            //       faceFeature.rect.rightBottom.x -= dW;
            //       faceFeature.rectClamp = true;
            //   }
            //f (in->config.clamp_feature_rect)
            //
            //   int dW = width - faceFeature.rect.width();
            //   if (dW < 0)
            //   {
            //       dW = std::abs(dW) / 2 + 1;
            //       faceFeature.rect.leftTop.x += dW;
            //       faceFeature.rect.rightBottom.x -= dW;
            //       faceFeature.rectClamp = true;
            //   }
            //   int dH = height - faceFeature.rect.height();
            //   if (dH < 0)
            //   {
            //       dH = std::abs(dH) / 2 + 1;
            //       faceFeature.rect.leftTop.y += dH;
            //       faceFeature.rect.rightBottom.y -= dH;
            //       faceFeature.rectClamp = true;
            //   }
            //
            //   int dH = height - faceFeature.rect.height();
            //   if (dH < 0)
            //   {
            //       dH = std::abs(dH) / 2 + 1;
            //       faceFeature.rect.leftTop.y += dH;
            //       faceFeature.rect.rightBottom.y -= dH;
            //       faceFeature.rectClamp = true;
            //   }
            //
            in->faceFeatures.push_back(faceFeature);
        }
            in->faceFeatures.push_back(faceFeature);
        }
    }
    //if (face_count > 0)
@@ -378,31 +380,31 @@
    //    fwrite (yMat.data , sizeof(char), 1920*1080*1.5, pFile);
    //    printf("write face file %s\n", fname);
    //    fclose(pFile);
    //  if (f>20)exit(0);
    //  if (f>20)exit(0);
    //}
    // release the memory of face
    cv_face_release_tracker_result(p_face, face_count);
    //#debug
    //if (face_count == 0)
    //{
    //    face_count = 2;
    //
    //    SensetimeFaceFeature faceFeature;
    //    faceFeature.rect.leftTop.x = 50;
    //    faceFeature.rect.leftTop.y = 50;
    //    faceFeature.rect.rightBottom.x = 50+128;
    //    faceFeature.rect.rightBottom.y = 50+128;
    //    in->faceFeatures.push_back(faceFeature);
    //#debug
    //if (face_count == 0)
    //{
    //    face_count = 2;
    //
    //    SensetimeFaceFeature faceFeature;
    //    faceFeature.rect.leftTop.x = 50;
    //    faceFeature.rect.leftTop.y = 50;
    //    faceFeature.rect.rightBottom.x = 50+128;
    //    faceFeature.rect.rightBottom.y = 50+128;
    //    in->faceFeatures.push_back(faceFeature);
    //    
    //    faceFeature.rect.leftTop.x = 300;
    //    faceFeature.rect.leftTop.y = 400;
    //    faceFeature.rect.rightBottom.x = 300+50;
    //    faceFeature.rect.rightBottom.y = 400+60;
    //    in->faceFeatures.push_back(faceFeature);
    //    faceFeature.rect.leftTop.y = 400;
    //    faceFeature.rect.rightBottom.x = 300+50;
    //    faceFeature.rect.rightBottom.y = 400+60;
    //    in->faceFeatures.push_back(faceFeature);
    //    LOG_WARN << "PL_SensetimeFaceTrack doFaceTrack add test data" << LOG_ENDL;
    //}
    //}
    return face_count;
}
@@ -460,14 +462,14 @@
    //LOG_ERROR << "PL_SensetimeFaceTrack pay" << LOG_ENDL;
    in->payError = true;
    if (in->payError)
        pm.breake(PipeMaterial::PMT_FRAME_LIST, MB_Frame::MBFT_YUV420, PL_SensetimeFaceTrack::pay_breaker_MBFT_YUV, in);
    if (in->payError)
        pm.breake(PipeMaterial::PMT_FRAME_LIST, MB_Frame::MBFT_NV12, PL_SensetimeFaceTrack::pay_breaker_MBFT_YUV, in);
    if (in->payError)
        pm.breake(PipeMaterial::PMT_FRAME, MB_Frame::MBFT_YUV420, PL_SensetimeFaceTrack::pay_breaker_MBFT_YUV, in);
    if (in->payError)
        pm.breake(PipeMaterial::PMT_FRAME, MB_Frame::MBFT_NV12, PL_SensetimeFaceTrack::pay_breaker_MBFT_YUV, in);
    if (in->payError)
        pm.breake(PipeMaterial::PMT_FRAME_LIST, MB_Frame::MBFT_YUV420, PL_SensetimeFaceTrack::pay_breaker_MBFT_YUV, in);
    if (in->payError)
        pm.breake(PipeMaterial::PMT_FRAME_LIST, MB_Frame::MBFT_NV12, PL_SensetimeFaceTrack::pay_breaker_MBFT_YUV, in);
    if (in->payError)
        pm.breake(PipeMaterial::PMT_FRAME, MB_Frame::MBFT_YUV420, PL_SensetimeFaceTrack::pay_breaker_MBFT_YUV, in);
    if (in->payError)
        pm.breake(PipeMaterial::PMT_FRAME, MB_Frame::MBFT_NV12, PL_SensetimeFaceTrack::pay_breaker_MBFT_YUV, in);
    in->frameCount++;
    
RtspFace/PipeLine.cpp
@@ -65,24 +65,24 @@
        for (size_t i = 0; i < buffSize; i++, pm++)
        {
            if (selectPmType == pm->type || selectPmType == PipeMaterial::PMT__FIRST || selectPmType == PipeMaterial::PMT__LAST)
            {
                if (pm->type == PipeMaterial::PMT_FRAME)
                {
                    MB_Frame *mbf = (MB_Frame *) pm->buffer;
                    if (selectMbfType == mbf->type || selectMbfType == MB_Frame::MBFT__FIRST || selectMbfType == MB_Frame::MBFT__LAST)
            {
                if (pm->type == PipeMaterial::PMT_FRAME)
                {
                    MB_Frame *mbf = (MB_Frame *) pm->buffer;
                    if (selectMbfType == mbf->type || selectMbfType == MB_Frame::MBFT__FIRST || selectMbfType == MB_Frame::MBFT__LAST)
                    {
                        called++;
                        if (!breaker(pm, args))
                            break;
                        if (!breaker(pm, args))
                            break;
                    }
                }
                else
                {
                }
                else
                {
                    called++;
                    if (!breaker(pm, args))
                        break;
                }
            }
                    if (!breaker(pm, args))
                        break;
                }
            }
        }
    }
    break;
@@ -157,7 +157,6 @@
    return true;
}
//static
bool PipeLine::register_global_elem_creator(const std::string& type, elem_create_func_t func)
{
@@ -190,6 +189,11 @@
    }
}
PipeLineElem* PipeLine::at(int idx)
{
    return elems[idx];
}
bool PipeLine::remove_elem(PipeLineElem* elem)
{
    if(elem != nullptr)
@@ -205,6 +209,26 @@
    }
    
    return false;
}
void PipeLine::finit(elem_destory_func_t elem_destory_func)
{
    while (!elems.empty())
    {
        PipeLineElem* elem = elems.back();
        if (elem->manager == this)
        {
            elem->finit();
            if (elem_destory_func != nullptr)
                elem_destory_func(elem);
        }
        elems.pop_back();
    }
    elem_create_func_map.clear();
    params_map.clear();
}
bool PipeLine::check_pipe_complete(PipeLineElem* lastRetElem) const
@@ -250,7 +274,7 @@
    if (pm == nullptr)
        pm = new (pmPlacement) PipeMaterial;
    
    bool lastRet = true;
    bool lastRet = true;
    if (elems.size() == 1)
    {
@@ -294,8 +318,8 @@
    
        if (lastRet)
            elem_last->pay(*pm);
        pm->exec_deleter(lastRet);
        return elem_last;
        pm->exec_deleter(lastRet);
        return elem_last;
    }
    
    return nullptr;
@@ -328,18 +352,18 @@
PipeLineElemTimingDebugger::PipeLineElemTimingDebugger(const PipeLineElem* _elem) : 
    elem(_elem), beginTime(0)
{
    struct timeval _beginTime;
    gettimeofday(&_beginTime, NULL);
    beginTime = 1000000 * _beginTime.tv_sec + _beginTime.tv_usec;
    struct timeval _beginTime;
    gettimeofday(&_beginTime, NULL);
    beginTime = 1000000 * _beginTime.tv_sec + _beginTime.tv_usec;
}
PipeLineElemTimingDebugger::~PipeLineElemTimingDebugger()
{
    struct timeval _endTime;
    gettimeofday(&_endTime, NULL);
    const uint64_t endTime = 1000000 * _endTime.tv_sec + _endTime.tv_usec;
    struct timeval _endTime;
    gettimeofday(&_endTime, NULL);
    const uint64_t endTime = 1000000 * _endTime.tv_sec + _endTime.tv_usec;
    LOGP(WARN, "elem=%s@%llu, dura=%llu(us)", typeid(elem).name(), uint64_t(elem), uint64_t(endTime - beginTime));
    LOGP(WARN, "elem=%s@%llu, dura=%llu(us)", typeid(elem).name(), uint64_t(elem), uint64_t(endTime - beginTime));
}
#else
PipeLineElemTimingDebugger::PipeLineElemTimingDebugger(const PipeLineElem* _elem) { }
RtspFace/PipeLine.h
@@ -78,6 +78,7 @@
};
typedef PipeLineElem* (*elem_create_func_t)();
typedef void (*elem_destory_func_t)(PipeLineElem* elem);
// 0 (there is no elem). do nothing
// 1 (there is one elem). gain --> pm.deleter
@@ -96,22 +97,20 @@
    
    bool register_elem_creator(const std::string& type, elem_create_func_t func);
    static bool register_global_elem_creator(const std::string& type, elem_create_func_t func);
    void push_elem(PipeLineElem* elem);
    PipeLineElem* push_elem(const std::string& type);
    void push_front_elem(PipeLineElem* elem);
    bool remove_elem(PipeLineElem* elem);
    PipeLineElem* at(int idx);
    void finit(elem_destory_func_t elem_destory_func);
    bool check_pipe_complete(PipeLineElem* lastRetElem) const;
    
    // do pipe sync. returns the element who returns false, or the last one.
    // if false return, the element should deal with pm, clean up.
    PipeLineElem* pipe(PipeMaterial* pm = nullptr);
    // do pipe async
    void pipe_start();
    void pipe_notify(PipeLineElem*);
    void pipe_stop();
    
    void set_param(const std::string& name, const std::string& value);
    std::string get_param(const std::string& name) const;