From 217b286ad5eb04084ab82e870d90a5d1809b3a28 Mon Sep 17 00:00:00 2001 From: houxiao <houxiao@454eff88-639b-444f-9e54-f578c98de674> Date: 星期三, 02 八月 2017 11:17:46 +0800 Subject: [PATCH] split client server --- VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapperServer.cpp | 40 +++++++++++++++++++++++++++++++++++++--- 1 files changed, 37 insertions(+), 3 deletions(-) diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapper.cpp b/VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapperServer.cpp similarity index 89% rename from VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapper.cpp rename to VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapperServer.cpp index 030841c..cbdfeb5 100644 --- a/VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapper.cpp +++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapperServer.cpp @@ -1,4 +1,4 @@ -#include "CameraWrapper.h" +#include "CameraWrapperServer.h" #include <logger.h> #include <Logger/src/logger.hpp> #include <MaterialBuffer.h> @@ -8,6 +8,7 @@ #include <PL_V4L2Source.h> #include <PL_BlockGrouping.h> #include <PL_ColorConv.h> +#include <PL_AndroidMediaCodecEncoder.h> CameraWrapper::~CameraWrapper() { @@ -31,6 +32,15 @@ running = false; return false; } + + //struct sched_param param; + //int policy = -1; + //int rc = pthread_getschedparam(decoder_thid, &policy, ¶m); + //LOGP(INFO, "pthread_getschedparam, rc=%d, policy=%d, priority=%d", rc, policy, param.__sched_priority); + //policy = SCHED_RR; + //param.__sched_priority = 1; + //rc = pthread_setschedparam(decoder_thid, policy, ¶m); + //LOGP(INFO, "pthread_getschedparam, rc=%d, policy=%d, priority=%d", rc, policy, param.__sched_priority); ret = pthread_create(&live_daemon_thid, NULL, CameraWrapper::live_daemon_thd, this); if(ret != 0) @@ -68,6 +78,9 @@ for (st_ff_vect_t::const_iterator iter = faceFeatures.begin(); iter != faceFeatures.end(); ++iter) { + if (!iter->test_face_in_cone(35.0f, 35.0f, 35.0f)) + continue; + RectWrapper rw; rw.rect = iter->rect; rw.user_score_1 = ((90.0f - std::abs(iter->yaw)) + (90.0f - std::abs(iter->pitch)) + (90.0f - std::abs(iter->roll))) / 90.0f / 3 * iter->score; @@ -89,6 +102,7 @@ PipeLine::register_global_elem_creator("PL_Paint", create_PL_Paint); PipeLine::register_global_elem_creator("PL_V4L2Source", create_PL_V4L2Source); PipeLine::register_global_elem_creator("PL_BlockGrouping", create_PL_BlockGrouping); + //PipeLine::register_global_elem_creator("PL_AndroidMediaCodecEncoder", create_PL_AndroidMediaCodecEncoder); bool ret = initPl_DecoderPl(); if (!ret) @@ -128,12 +142,30 @@ } PL_Scale* plScale = (PL_Scale*)pipeLineRender->push_elem("PL_Scale"); + plScaleCfg.toWidth = 640; + plScaleCfg.toHeight = 480; ret = plScale->init(&plScaleCfg); if (!ret) { LOG_ERROR << "pipeLineRender.plScale init error" << LOG_ENDL; return false; } + + //PL_AndroidMediaCodecEncoder_Config amceCfg; + //amceCfg.ak_bit_rate = 5000000; // 512KB + //amceCfg.ak_color_format = 21; // COLOR_FormatYUV420SemiPlanar; + //amceCfg.ak_frame_rate = 25; + //amceCfg.ak_height = 480; + //amceCfg.ak_i_frame_interval = 20; + //amceCfg.ak_mime = "video/avc"; + //amceCfg.ak_width = 640; + //PL_AndroidMediaCodecEncoder* plAMCE = (PL_AndroidMediaCodecEncoder*)pipeLineRender->push_elem("PL_AndroidMediaCodecEncoder"); + //ret = plAMCE->init(&amceCfg); + //if (!ret) + //{ + // LOG_ERROR << "pipeLineRender.plAMCE init error" << LOG_ENDL; + // return false; + //} PL_ColorConv_Config PLColorConvCfg; PL_ColorConv* plColorConv = (PL_ColorConv*)pipeLineRender->push_elem("PL_ColorConv"); @@ -280,7 +312,7 @@ { plplContext.cmds.push_back(PLPLC_COLOR); plplContext.params.push_back('F'); - if (iter->test_face_in_cone(30.0f, 30.0f, 30.0f)) + if (iter->test_face_in_cone(35.0f, 35.0f, 35.0f)) { if (iter->outOfFrame) { @@ -429,7 +461,9 @@ //#debug //test_paint(cameraWrapper); - cameraWrapper.pipeLineRender->pipe(&pm); + cameraWrapper.pipeLineRender->pipe(&pm);//#todo + //if (cameraWrapper.pipeLineRender->check_pipe_complete(last = cameraWrapper.pipeLineRender->pipe(&pm))) + // last->gain(pm); } LOG_INFO << "CameraWrapper::decoder_thd stop, ret=" << LOG_ENDL; -- Gitblit v1.8.0