我们研究了Mediastreamer2 VoIP引擎。第12部分

文章资料取自我的禅宗频道



在上一篇文章中,我答应考虑一下估计置顶器上的负载以及解决媒体流媒体中过多的计算负载的方法的问题。但是我认为,覆盖与移动数据相关的工艺过滤器的调试问题,然后再考虑性能优化问题,将更具逻辑性。


调试工艺过滤器


在上一篇文章中研究了在流媒体中移动数据的机制之后,谈论潜伏在其中的危险将是合乎逻辑的。“数据流”原理的特征之一是,来自堆的内存分配发生在位于数据流源的过滤器中,而位于流路径末尾的过滤器使内存释放并返回到堆。此外,新数据的创建和销毁可能会在中间点的某个地方发生。通常,释放内存是由创建数据块的错误过滤器执行的。


, , , , . — , . , , — / .


, , ( ). "" "" . , . . "" , MS_TEE , . , : ms_free(). , , .. "". ( ) .


"" , . — . , . , , , "" , .


?


, top , .


, - , . , . , , ..


( ). Valgrind ( ) gcc MemorySanitizer - . , , .



, , . "" , , , . , , .


"" , , .


, . , .



. .



, F1...F4, , . , . , , N- . , MS_VOID_SOURCE. — . . .. .


, , , , "" , , . . , , . — , . - .


voidsourse:


, , , . , ( ). , . , , , "" . , . "" , . ( ). "" , .


-


. :


/*  iso_filter.h    . */

#ifndef iso_filter_h
#define iso_filter_h

/*   . */
#include <mediastreamer2/msfilter.h>

#define MY_ISO_FILTER_ID 1024

extern MSFilterDesc iso_filter_desc;

#endif

:


/*  iso_filter.c    . */

#include "iso_filter.h"

    static void
iso_init (MSFilter * f)
{
}
    static void
iso_uninit (MSFilter * f)
{
}

    static void
iso_process (MSFilter * f)
{
    mblk_t *im;

    while ((im = ms_queue_get (f->inputs[0])) != NULL)
    {
        ms_queue_put (f->outputs[0], copymsg (im));
        freemsg (im);
    }
}

static MSFilterMethod iso_methods[] = {
    {0, NULL}
};

MSFilterDesc iso_filter_desc = {
    MY_ISO_FILTER_ID,
    "iso_filter",
    "A filter that reads from input and copy to its output.",
    MS_FILTER_OTHER,
    NULL,
    1,
    1,
    iso_init,
    NULL,
    iso_process,
    NULL,
    iso_uninit,
    iso_methods
};

MS_FILTER_DESC_EXPORT (iso_desc)


, , ", ". . :


OrtpMemoryFunctions reserv;
OrtpMemoryFunctions my;

reserv.malloc_fun = ortp_malloc;
reserv.realloc_fun = ortp_realloc;
reserv.free_fun = ortp_free;

my.malloc_fun = &my_malloc;
my.realloc_fun = &my_realloc;
my.free_fun = &my_free;

ortp_set_memory_functions(&my);

, , . .


, . , , .


在下一篇文章中,我们将考虑估计股票行情指示器的负载以及处理媒体流媒体中过多计算负载的方法。


All Articles