houxiao
2017-07-20 5f5e870de69efe56d571a2c93362942af5bb49a5
restart

git-svn-id: http://192.168.1.226/svn/proxy@764 454eff88-639b-444f-9e54-f578c98de674
6个文件已修改
80 ■■■■ 已修改文件
RtspFace/PL_AndroidMediaCodecDecoder_ndk.cpp 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PL_RTSPClient.cpp 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PL_RTSPClient.h 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PL_SensetimeFaceTrack.cpp 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PipeLine.cpp 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PipeLine.h 9 ●●●●● 补丁 | 查看 | 原始文档 | 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
@@ -33,11 +33,13 @@
    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,10 +195,22 @@
        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;
    }
    
@@ -200,6 +220,13 @@
    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)
@@ -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
@@ -173,6 +173,8 @@
    // 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)
@@ -209,7 +211,7 @@
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)
        return 0;
RtspFace/PipeLine.cpp
@@ -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)
@@ -207,6 +211,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
{
    if (elems.empty())
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
@@ -101,17 +102,15 @@
    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;