b2g入口:b2g做了些什么工作

ffos:init,b2g 启动过程 try to analyze b2g ,nuwa and content process. 自我疑惑问题记录与解答。。。 系统物理按键按下,固件(firmware)bootloader按需加载文件到内存?(加载内核进内存),kernel run脚本?启动init进程,解析init.rc,init.b2g.rc, init进程启动b2g进程,init同时?启动一些守护进程(deamon :ril... 阅读详情

之前看的是init到系统启动到system app再到system app 将其他核心应用启动起来的过程。那么支持上层应用的底层(gecko 层的这些组件又做了什么呢?)

启动过程总览:

物理按键---->固件(firmware)--->(加载/启动)内核(kernel)---->init进程--->解析init.rc/init.b2g.rc(有b2g.sh)---->b2g.sh--->system/b2g/b2g(可执行文件由gecko/b2g/...生成)--->(something i need to study now!!!)--->libxul(.so)--->b2g.js--->shell.html--->shell.js(SystemAppFrame(id=systemapp),load blank.html into this iframe)--->system app--->core app(homescreen ect...)

而另一条线即是,b2g(可执行文件被执行之后(b2g进程)做了哪些支撑工作)

 

b2g进程底层做的工作。

理清:

XPCOM的初始化,

以及如何支持上层的应用(有点大了)。

init进程启动许多进程,其中之一就是gecko的入口b2g,实际就是通过运行b2g.sh脚本执行了b2g可执行文件,b2g是gecko/b2g/app/B2GLoader.cpp编译生成的。

主要分析b2g进程做了什么,从而支撑上层应用正常运行。

gecko/xpcom/build/nsXULAppAPI.h

/**
 * Begin an XUL application. Does not return until the user exits the
 * application.
 *
 * @param argc/argv Command-line parameters to pass to the application. On
 *                  Windows, these should be in UTF8. On unix-like platforms
 *                  these are in the "native" character set.
 *
 * @param aAppData  Information about the application to be run.
 *
 * @param aFlags    Platform specific flags.
 *
 * @return         A native result code suitable for returning from main().
 *
 * @note           If the binary is linked against the standalone XPCOM glue,
 *                 XPCOMGlueStartup() should be called before this method.
 */
XRE_API(int,
        XRE_main, (int argc, char* argv[], const nsXREAppData* aAppData,
                   uint32_t aFlags))

XRE_API()定义在xrecore.h中

gecko/xpcom/build/xrecore.h


#include "nscore.h"

/**
 * Import/export macros for libXUL APIs.
 */
#ifdef XPCOM_GLUE
#define XRE_API(type, name, params) \
  typedef type (NS_FROZENCALL * name##Type) params; \
  extern name##Type name NS_HIDDEN;
#elif defined(IMPL_LIBXUL)
#define XRE_API(type, name, params) EXPORT_XPCOM_API(type) name params;
#else
#define XRE_API(type, name, params) IMPORT_XPCOM_API(type) name params;
#endif


gecko/xpcom/base/nscore.h


/* Core XPCOM declarations. */

/*----------------------------------------------------------------------*/
/* Import/export defines */

...

#define EXPORT_XPCOM_API(type) NS_EXTERN_C NS_EXPORT type NS_FROZENCALL
#define IMPORT_XPCOM_API(type) NS_EXTERN_C NS_IMPORT type NS_FROZENCALL
#define GLUE_XPCOM_API(type) NS_EXTERN_C NS_HIDDEN_(type) NS_FROZENCALL

#ifdef IMPL_LIBXUL
#define XPCOM_API(type) EXPORT_XPCOM_API(type)
#elif defined(XPCOM_GLUE)
#define XPCOM_API(type) GLUE_XPCOM_API(type)
#else
#define XPCOM_API(type) IMPORT_XPCOM_API(type)
#endif

gecko/xpcom/build/nsXPCOMCID.h 定义XPCOM核心CID。

 

main 函数主要执行3个大模块的函数:
  ReserveFileDescriptors(reservedFds);
  bool ok = LoadStaticData(argc, argv);
  return RunProcesses(argc, argv, reservedFds); b2g进程与Nuwa之间具体如何通过ipc进行 通信并使nuwa创建出新进程

(0)main()如下:


/**
 * B2G Loader is responsible for loading the b2g process and the
 * Nuwa process.  It forks into the parent process, for the b2g
 * process, and the child process, for the Nuwa process.
 *
 * The loader loads libxul and performs initialization of static data
 * before forking, so relocation of libxul and static data can be
 * shared between the b2g process, the Nuwa process, and the content
 * processes.
 */
int
main(int argc, const char* argv[])
{
  // argc :1
  // argv :system/b2g/b2g 
  /**
   * Reserve file descriptors before loading static data.
   */
  FdArray reservedFds;
  ReserveFileDescriptors(reservedFds);
/*
   * Before fork(), libxul and static data of Gecko are loaded for
   * sharing.
   */
  bool ok = LoadStaticData(argc, argv);
  if (!ok) {
    return 255;
  }
  return RunProcesses(argc, argv, reservedFds);
}

(1)  ReserveFileDescriptors(reservedFds);

保留文件描述符(5个吗)。为什么?以供后用?3-7?

 

(2)  bool ok = LoadStaticData(argc, argv);

1.1 主要分析loadstaticdata部分,它是在runprocesses前要做的工作,主要是loadlibxul,和xre_procloaderpreload。前者load了libxul具体是去调xpcomglue相关的enablepreload,startup,loadxulfunction等,这几个的具体工作还需继续,总体来说就是执行了xpcom相关的几个重要函数。xre_procloaderpreload的主要任务则是在xpcom初始化之前加载好xpt接口信息。

加载固定的数据

static bool
LoadStaticData(int argc, const char *argv[])
{
  P_LOGI( );
  char xpcomPath[MAXPATHLEN];
  bool ok = GetXPCOMPath(argv[0], xpcomPath, MAXPATHLEN);
  NS_ENSURE_TRUE(ok, false);

  ok = LoadLibxul(xpcomPath);
  NS_ENSURE_TRUE(ok, false);

  char progDir[MAXPATHLEN];
  ok = GetDirnameSlash(xpcomPath, progDir, MAXPATHLEN);
  NS_ENSURE_TRUE(ok, false);

  nsCOMPtr<nsIFile> appini = GetAppIni(argc, argv);
  const nsXREAppData *appData;
  if (appini) {
    nsresult rv =
      XRE_CreateAppData(appini, const_cast<nsXREAppData**>(&appData));
    NS_ENSURE_SUCCESS(rv, false);
  } else {
    appData = &sAppData;
  }

  XRE_ProcLoaderPreload(progDir, appData);

  if (appini) {
    XRE_FreeAppData(const_cast<nsXREAppData*>(appData));
  }

  return true;
}

LoadStaticData

主要看

{

  ok = LoadLibxul(xpcomPath);

  XRE_ProcLoaderPreload(progDir, appData);// toolkit/xre/nsEmbedFunctions.cpp and xpcom/build/nsXULAppAPI.h

}

XRE_ProcLoaderPreload()用于加载XPT接口模块库,PreloadXPT().

#ifdef MOZ_B2G_LOADER
extern const nsXREAppData* gAppData;

/**
 * Preload static data of Gecko for B2G loader.
 *
 * This function is supposed to be called before XPCOM is initialized.
 * For now, this function preloads
 *  - XPT interface Information
 */
void
XRE_ProcLoaderPreload(const char* aProgramDir, const nsXREAppData* aAppData)
{
    void PreloadXPT(nsIFile *);

    nsresult rv;
    nsCOMPtr<nsIFile> omnijarFile;
    rv = NS_NewNativeLocalFile(nsCString(aProgramDir),
			       true,
			       getter_AddRefs(omnijarFile));
    MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));

    rv = omnijarFile->AppendNative(NS_LITERAL_CSTRING(NS_STRINGIFY(OMNIJAR_NAME)));
    MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));

    /*
     * gAppData is required by nsXULAppInfo.  The manifest parser
     * evaluate flags with the information from nsXULAppInfo.
     */
    gAppData = aAppData;

    PreloadXPT(omnijarFile);

    gAppData = nullptr;
}
#endif /* MOZ_B2G_LOADER */

 

 

 

LoadLibxul:

 


#ifdef XPCOM_GLUE

/**
 * The following functions are only available in the standalone glue.
 */

/**
 * Enabled preloading of dynamically loaded libraries
 */
extern "C" NS_HIDDEN_(void) XPCOMGlueEnablePreload();

/**
 * Initialize the XPCOM glue by dynamically linking against the XPCOM
 * shared library indicated by xpcomFile.
 */
extern "C" NS_HIDDEN_(nsresult) XPCOMGlueStartup(const char* aXPCOMFile);

typedef void (*NSFuncPtr)();

struct nsDynamicFunctionLoad
{
  const char* functionName;
  NSFuncPtr* function;
};

/**
 * Dynamically load functions from libxul.
 *
 * @throws NS_ERROR_NOT_INITIALIZED if XPCOMGlueStartup() was not called or
 *         if the libxul DLL was not found.
 * @throws NS_ERROR_LOSS_OF_SIGNIFICANT_DATA if only some of the required
 *         functions were found.
 */
extern "C" NS_HIDDEN_(nsresult)
XPCOMGlueLoadXULFunctions(const nsDynamicFunctionLoad* aSymbols);


Enabled preloading of dynamically loaded libraries,使预加载动态链接库。
 
extern "C" NS_HIDDEN_(void) XPCOMGlueEnablePreload();

NS_HIDDEN_(nsresult) XPCOMGlueStartup(const char* aXPCOMFile);

通过动态链接XPCOM 共享库来初始化由xpcomFile指示的XPCOM glue。

 

 

 

sed -n 898,935p toolkit/xre/nsEmbedFunctions.cpp

#ifdef MOZ_B2G_LOADER
extern const nsXREAppData* gAppData;

/**
 * Preload static data of Gecko for B2G loader.
 *
 * This function is supposed to be called before XPCOM is initialized.
 * For now, this function preloads
 *  - XPT interface Information
 */
void
XRE_ProcLoaderPreload(const char* aProgramDir, const nsXREAppData* aAppData)
{
    void PreloadXPT(nsIFile *);

    nsresult rv;
    nsCOMPtr<nsIFile> omnijarFile;
    rv = NS_NewNativeLocalFile(nsCString(aProgramDir),
			       true,
			       getter_AddRefs(omnijarFile));
    MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));

    rv = omnijarFile->AppendNative(NS_LITERAL_CSTRING(NS_STRINGIFY(OMNIJAR_NAME)));
    MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));

    /*
     * gAppData is required by nsXULAppInfo.  The manifest parser
     * evaluate flags with the information from nsXULAppInfo.
     */
    gAppData = aAppData;

    PreloadXPT(omnijarFile);

    gAppData = nullptr;
}
#endif /* MOZ_B2G_LOADER */

 

 

(3)RunProcesses()如下:

1.1 主要分析runprocesses部分,runprocesses中xreprocloaderservicerun会被server process调用,当它接收到load请求时就会执行content process的主函数。而procloaderclientinit则是被b2g loader调用,用于初始化client 端,然后runprocesses调用b2g_main启动b2g进程。

目的:

/**
 * Fork and run parent and child process.
 * The parent is the b2g process and child for Nuwa.
 */
一开始就有一个进程?init?fork出b2g,b2g fork nuwa???who fork them? B2GLoader程序?

 XRE_ProcLoaderServiceRun(getppid(), childSock, argc, argv,..);运行服务端进程(被server process 调用)(ipc/glue/ProcessUtils_linux.cpp)

  XRE_ProcLoaderClientInit(childPid, parentSock, aReservedFds);客户端进程(b2g process)初始化

b2g_main(...);具体工作是:启动b2g 进程

 

static int
RunProcesses(int argc, const char *argv[], FdArray& aReservedFds)
{//fork process here 
  P_LOGI("enter RunProcesses");
  /*
   * The original main() of the b2g process.  It is renamed to
   * b2g_main() for the b2g loader.
   */
  int b2g_main(int argc, const char *argv[]);//just define
//P_LOGI("call-e b2g_main");
  int ipcSockets[2] = {-1, -1};
  int r = socketpair(AF_LOCAL, SOCK_STREAM, 0, ipcSockets);
  ASSERT(r == 0);
  int parentSock = ipcSockets[0];
  int childSock = ipcSockets[1];

  r = fcntl(parentSock, F_SETFL, O_NONBLOCK);
  ASSERT(r != -1);
  r = fcntl(childSock, F_SETFL, O_NONBLOCK);
  ASSERT(r != -1);

  pid_t pid = fork();
  ASSERT(pid >= 0);
  bool isChildProcess = pid == 0;

  close(isChildProcess ? parentSock : childSock);

  if (isChildProcess) {
    P_LOGI("isChildProcess is not null,return XRE_ProcLoaderServiceRun");
    /* The Nuwa process */
    /* This provides the IPC service of loading Nuwa at the process.
     * The b2g process would send a IPC message of loading Nuwa
     * as the replacement of forking and executing plugin-container.
     */
    return XRE_ProcLoaderServiceRun(getppid(), childSock, argc, argv,
                                    aReservedFds);
  }

  // Reap zombie child process.
  struct sigaction sa;
  sa.sa_handler = SIG_IGN;
  sigemptyset(&sa.sa_mask);
  sa.sa_flags = 0;
  sigaction(SIGCHLD, &sa, nullptr);

  // The b2g process
  int childPid = pid;
  P_LOGI("the b2g process pid:%d",pid);
  //P_LOGI("call-s XRE_ProcLoaderClientIni");
  XRE_ProcLoaderClientInit(childPid, parentSock, aReservedFds);
  //from xpcom/build/nsXULAppAPI.h to load/define ipc client of the process?
  //P_LOGI("call-e XRE_ProcLoaderClientInit");
  P_LOGI("call-s b2g_main");
  return b2g_main(argc, argv);
}

gecko/ipc/glue/ProcessUtils_linux.cpp
#ifdef MOZ_B2G_LOADER
void
XRE_ProcLoaderClientInit(pid_t aPeerPid, int aChannelFd, FdArray& aReservedFds)
{
  // We already performed fork(). It's safe to free the "danger zone" of file
  // descriptors .
  mozilla::ipc::CloseFileDescriptors(aReservedFds);

  mozilla::ipc::ProcLoaderClientInit(aPeerPid, aChannelFd);
}

int
XRE_ProcLoaderServiceRun(pid_t aPeerPid, int aFd,
                         int aArgc, const char *aArgv[],
                         FdArray& aReservedFds)
{
  return mozilla::ipc::ProcLoaderServiceRun(aPeerPid, aFd,
                                            aArgc, aArgv,
                                            aReservedFds);
}
#endif /* MOZ_B2G_LOADER */

b2g loader 如何工作:

/**
 * How does B2G Loader Work?
 *
 *  <<parent process>>      <<child process>>
 *   ProcLoaderParent -----> ProcLoaderChild
 *         ^                       |
 *         | load()                | content_process_main()
 *         |                       V
 *     ProcLoaderClient      Nuwa/plugin-container
 *         ^
 *         | ProcLoaderLoad()
 *        ...
 *     ContentParent
 *
 *
 * B2G loader includes an IPC protocol PProcLoader for communication
 * between client (parent) and server (child).  The b2g process is the
 * client.  It requests the server to load/start the Nuwa process with
 * the given arguments, env variables, and file descriptors.
 *
 * ProcLoaderClientInit() is called by B2G loader to initialize the
 * client side, the b2g process.  Then the b2g_main() is called to
 * start b2g process.
 *
 * ProcLoaderClientGeckoInit() is called by XRE_main() to create the
 * parent actor, |ProcLoaderParent|, of PProcLoader for servicing the
 * request to run Nuwa process later once Gecko has been initialized.
 *
 * ProcLoaderServiceRun() is called by the server process.  It starts
 * an IOThread and event loop to serve the |ProcLoaderChild|
 * implmentation of PProcLoader protocol as the child actor.  Once it
 * recieves a load() request, it stops the IOThread and event loop,
 * then starts running the main function of the content process with
 * the given arguments.
 *
 * NOTE: The server process serves at most one load() request.
 */

目的:

/**
 * Fork and run parent and child process.
 * The parent is the b2g process and child for Nuwa.
 */

Runprocesses

{

    return XRE_ProcLoaderServiceRun(getppid(), childSock, argc, argv,
                                    aReservedFds);

  XRE_ProcLoaderClientInit(childPid, parentSock, aReservedFds);

  return b2g_main(argc, argv);

}

 

 

 

谁调了这个mian???

ipc/app/MozillaRuntimeMain.cpp

#include "../contentproc/plugin-container.cpp"
 
int
main(int argc, char *argv[]) {
    return content_process_main(argc, argv);
}

 

plugin-container.cpp

conentprocessmain()

 

gecko/xpcom/glue/standalone/nsXPCOMGlue.cpp

LoadStaticData()--->Loadlibxul()  ---->xpcomgluestartup()

 

 

 

 

参考:

写的很清楚:

Firefox OS启动过程分析-b2g进程启动

2015年09月16日 16:06:28

阅读数:1113

b2g启动时,运行”/system/b2g/b2g”,入口在”gecko/b2g/app/B2GLoader.cpp”中,如下:

int
main(int argc, const char* argv[])
{
  /**
   * Reserve file descriptors before loading static data.
   */
  FdArray reservedFds;
  ReserveFileDescriptors(reservedFds);

  /*
   * Before fork(), libxul and static data of Gecko are loaded for
   * sharing.
   */
  bool ok = LoadStaticData(argc, argv);
  if (!ok) {
    return 255;
  }

  return RunProcesses(argc, argv, reservedFds);

代码执行流程如下所示:

main()     (b2g/app/B2GLoader.cpp)
|
|-ReserveFileDescriptors
|
|-LoadStaticData
|
|-RunProcesses
       |
       |-fork
       |
       |-XRE_ProcLoaderServiceRun      (child(nuwa) process)
       |
       |-b2g_main               (parent(b2g) process) (b2g/app/nsBrowserApp.cpp)
                |
                |-android::ProcessState::self()->startThreadPool();
                |
                |-(void)setsid();
                |
                |-do_main
                         |
                         |-mozilla::StartBootAnimation();
                         |
                         |-XRE_main
                               |
                               |-XREMain::XRE_main
                                      |
                                      |-new ScopedAppData(aAppData);
                                      |
                                      |-XREMain::XRE_mainInit
                                      |
                                      |-XREMain::XRE_mainStartup
                                      |
                                      |-mScopedXPCOM = MakeUnique<ScopedXPCOMStartup>();
                                      |
                                      |-mScopedXPCOM->Initialize();          (toolkit/xre/nsAppRunner.cpp)
                                      |           |
                                      |           |-NS_InitXPCOM2                       (xpcom/build/XPCOMInit.cpp)
                                      |                  |
                                      |                  |-sMessageLoop = new MessageLoopForUI(MessageLoop::TYPE_MOZILLA_UI);
                                      |                  |
                                      |                  |-ioThread = MakeUnique<BrowserProcessSubThread>(BrowserProcessSubThread::IO);
                                      |                  |-ioThread->StartWithOptions
                                      |                  |
                                      |                  |-nsThreadManager::get()->Init();
                                      |                  |
                                      |                  |-nsTimerImpl::Startup();
                                      |                  |
                                      |                  |-nsComponentManagerImpl::gComponentManager = new nsComponentManagerImpl();
                                      |                  |
                                      |                  |-nsCycleCollector_init
                                      |                  |
                                      |                  |-nsCycleCollector_startup
                                      |                  |
                                      |                  |-JS_Init
                                      |                  |
                                      |                  |-nsComponentManagerImpl::gComponentManager->Init();(xpcom/components/nsComponentManager.cpp)
                                      |                  |     |
                                      |                  |     |-nsComponentManagerImpl::InitializeStaticModules()
                                      |                  |     |
                                      |                  |     |-RegisterModule(...)
                                      |                  |     |
                                      |                  |     |-greOmnijar =mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE);
                                      |                  |     |
                                      |                  |     |-cl->location.Init(greOmnijar, "chrome.manifest");
                                      |                  |     |
                                      |                  |     |-nsComponentManagerImpl::RereadChromeManifests
                                      |                  |               |
                                      |                  |               |-nsComponentManagerImpl::RegisterManifest
                                      |                  |                       |
                                      |                  |                       |-DoRegisterManifest
                                      |                  |                                |
                                      |                  |                                |-ParseManifest
                                      |                  |                                      |
                                      |                  |                                      |-...
                                      |                  |                                      |
                                      |                  |                                      |-nsComponentManagerImpl::ManifestContract 
                                      |                  |
                                      |                  |-XPTInterfaceInfoManager::GetSingleton();
                                      |                  |
                                      |                  |-nsDirectoryService::gService->RegisterCategoryProviders();
                                      |                  |
                                      |                  |-SharedThreadPool::InitStatics();
                                      |                  |
                                      |                  |-AbstractThread::InitStatics();
                                      |                  |
                                      |                  |-mozilla::scache::StartupCache::GetSingleton();
                                      |                  |
                                      |                  |-mozilla::AvailableMemoryTracker::Activate();
                                      |                  |
                                      |                  |-NS_CreateServicesFromCategory(...)
                                      |                  |
                                      |                  |-mozilla::HangMonitor::Startup();
                                      |                  |
                                      |                  |-mozilla::BackgroundHangMonitor::Startup();
                                      |                  |
                                      |                  |-sMainHangMonitor = new mozilla::BackgroundHangMonitor
                                      |                  
                                      |-XREMain::XRE_mainRun()
                                               |
                                               |-mozilla::ipc::ProcLoaderClientGeckoInit();
                                               |
                                               |-mScopedXPCOM->SetWindowCreator(mNativeApp);
                                               |
                                               |-startupNotifier->Observe(nullptr, APPSTARTUP_TOPIC, nullptr);
                                               |
                                               |-mDirProvider.DoStartup();
                                               |
                                               |-cmdLine->Init(...)
                                               |
                                               |-obsService->NotifyObservers(cmdLine, "command-line-startup", nullptr);
                                               |
                                               |-appStartup->CreateHiddenWindow();
                                               |
                                               |-obsService->NotifyObservers(nullptr, "final-ui-startup", nullptr);
                                               |
                                               |-cmdLine->Run();     (toolkit/components/commandlines/nsCommandLine.cpp)
                                               |          |
                                               |          |- nsCommandLine::EnumerateValidators
                                               |          |
                                               |          |-nsCommandLine::EnumerateHandlers
                                               |                  |
                                               |                  |-EnumRun
                                               |                        |
                                               |                        |-nsICommandLineHandler->Handle   (first page will be loaded in here)        
                                               |                                  
                                               |-mNativeApp->Enable();
                                               |
                                               |-appStartup->Run();     (toolkit/components/startup/nsAppStartup.cpp)
                                                         |
                                                         |-mAppShell->Run();         (widget/gonk/nsAppShell.cpp->widget/nsBaseAppShell.cpp)
                                                                  |
                                                                  |-MessageLoop::current()->Run();  // run forever~~~~~
  •  

b2g进程启动中,会做以下几件事:
1. 在加载库文件之前保留5个文件描述符(从STDERR_FILENO+1开始)

  FdArray reservedFds;
  ReserveFileDescriptors(reservedFds);

2.加载进程间能共享的各种数据(主要加载libxul等各种共享库,从Omnijar文件中加载各种模块的xpt信息),这样可以节约些内存。

bool ok = LoadStaticData(argc, argv);

3.开始fork进程。父亲就是b2g进程,儿子就是nuwa进程(后续再讲)。其中b2g进程具有系统root权限,负责处理系统的io,显示,操作底层硬件等。
在b2g进程中运行后,需要初始化xpcom,即调用:

  rv = NS_InitXPCOM2(&mServiceManager,gDirServiceProvider->GetAppDir(), gDirServiceProvider);

最后,b2g进程会进入一个message loop中,等待处理各种请求:

appStartup->Run();

Firefox OS中进程可以分为三类:b2g进程,nuwa进程,以及content进程。其中content进程都是由nuwa进程生成的(当然在nuwa进程未ready,但又需要fork进程的时候,有可能会由b2g进程直接生成)。

nuwa进程是如何创建新进程?b2g是如何加载第一个程序(system)的?后续文章中进行讲解。

个人分类: Gecko

 

Firefox OS启动过程分析-b2g进程启动 b2g启动时,运行”/system/b2g/b2g”,入口在”gecko/b2g/app/B2GLoader.cpp”中,如下:int main(int argc, const char* argv[]) { /** * Reserve file descriptors before loading static data. */ FdArray reservedFds; R 阅读详情

相关推荐

FreeSWITCH 作为信令 B2BUA 时处理 G.729 的场景

通过合理配置,FreeSWITCH 可作为高效的信令 B2BUA,同时完全剥离媒体处理职责,降低服务器负载并提升系统扩展性。当 FreeSWITCH 作为纯信令 B2BUA(不处理媒体流)时,的场景中,编解码器协商的逻辑会发生显著变化。在 FreeSWITCH 作为。纯信令 B2BUA 场景下,

唯有代码让我痴狂 1137

B2G系统简介(部分资料来源于网上)

一、      B2G介绍 B2G是“Boot To Gecko”的缩写,是Mozilla公司基于Web标准开发的完全开放的移动操作系统,从系统本身到应用程序完全由HTML5、CSS和JS来写的。 B2G将为用户提供一个基于网络的操作平台,该平台将直接和设备的内核进行交互,而系统 上的所有应用和内容都是基于网络的。在这个Web平台上提供和优化蓝牙、短信等原生App的功能,与原生HTML5应用紧

愤怒的菜鸟 4505

色温曲线坐标轴的选取:G/R、G/B还是R/G、B/G ?

作为坐标系映射的白点在坐标系的位置相对会分散一点些,特别是对较低色温而言,低色温的映射到色温曲线的时候,其端点会远离其他色温的映射点,作为坐标系时,距离其他色温比较远,导致分段直线拟合的时候误差可能会比较大,在低照度低色温做白平衡的时候,可能就没那么准确了。比如海思的色温曲线,除了低色温远一点,其他色温都在拟合曲线周边不远处,横向纵向都比较集中。要小,这样分段拟合色温曲线的时候误差应该更小些,为后续计算色温等提高根据准确的方式。作为坐标系的两轴,把各个色温下的白点映射到该坐标系的时候,其均匀性没有以。

大熊 2834

Mozilla Firefox os系统构架详解

原文地址:http://www.firefoxos.cc/thread-711-1-1.html Terminology(术语) Gaia: B2G系统的用户界面。B2G系统启动后,手机屏幕上所绘制的所有内容都属于Gaia的一部分。也就是说在B2G系统中,用户所见到的几乎所有的UI界面都是基于Gaia实现的。Gaia实现了锁屏、主屏、拨号键盘、短信应用、相机应用......。Gaia是完全...

weixin_30326515的博客 452

b2g-misc:用于处理 b2g 的脚本和文件

b2g-杂项 用于处理 b2g 设备和模拟器的各种脚本和文件 指数 import-ca-cert.js 用于将 CA 证书添加到模拟器(在设备上不起作用 - 但是?) proxyfiy-all.js 告诉 b2g 通过给定的 IP 地址代理一切¹ PnH-FxOS.js 从符合 PnH 的 mitm 代理安装 CA 证书的工具。 ¹ 并非所有 WebAPI 都尊重这一点。

【小程序】支付宝直付通解决方案

支付宝直付通是支付宝为小程序提供的一种支付解决方案,可以实现小程序中直接使用支付宝进行支付。以上是一个简单的支付宝直付通解决方案及相关代码示例。具体的使用还需要根据自己的业务需求进行定制化开发和调整。

qq_31532979的贺公子之数据科学与艺术博客,致力于科技向善,拥抱开源,要用技术的影响力来领导团队,而不是威权和职位! 1287

Nexus5 的B2G OS v2.6系统源码编译机制详解

1.前提     1、我在比对了Nexus5 的B2G OS v2.6系统与Nexus5 的Android4.4.4 系统后,发现B2G系统的编译虽然和Android一样依赖于build/、device/、vendor/,但是其在源码根目录上添加了一些辅助源码下载、编译的脚本(就是下图所示的绿色这些*.sh)。所以它的编译并不是像Android系统编译那样上来直接去执行source build/...

Android系统工程师--小馬佩德罗 685

CMOS锁相环核心:四种鉴频鉴相器(PFD)结构深度剖析与选型指南

本文深入剖析了CMOS锁相环中四种鉴频鉴相器(PFD)的结构与性能,包括传统RS触发器型、非时钟型、预充电型和边沿触发型PFD。通过详细的电路分析、实测数据和工程案例,提供了PFD选型的实用指南,帮助工程师根据速度、功耗和精度需求选择最优方案,提升锁相环设计效率。

weixin_42530458的博客 602

[创业之路-200]:什么是business(业务)?B2B, B2C, B2G业务, 什么是业务设计?

Business(业务)通常指的是一个组织或企业进行的各种活动,这些活动旨在创造、提供和交换商品或服务,以满足市场需求并从中获取经济收益。它是经济的驱动力,不仅关乎个人和企业的生存和发展,也影响着整个社会的繁荣。

文火冰糖(王文兵)的博客 3122

PMOS缓启动电路设计:D4与D6二极管的关键作用与选型

在电源输入级设计中,硬开关带来的浪涌电流和系统复位问题普遍存在。缓启动电路通过控制PMOS栅极电压变化率,限制浪涌电流,确保系统稳定上电。其核心原理是利用二极管D4和D6构建不对称充放电路径,实现慢开快关,从而提升可靠性。该技术广泛应用于工业控制、消费电子等低压直流输入场景,有效防止过流损坏和时序紊乱。

weixin_26873711的博客 264

PostgreSQL+PostGIS实战:5分钟搞定Shapefile数据导入(附避坑指南)

本文详细介绍了如何使用PostgreSQL和PostGIS快速导入Shapefile空间数据,包括5分钟标准流程和常见问题解决方案。通过实战案例和避坑指南,帮助GIS工程师高效处理矢量数据导入中的编码、几何类型、坐标系等典型问题,提升空间数据库管理效率。

weixin_42565652的博客 403

b2g 中各进程启动框图

居然没看到这里的图,浪费我好多时间,,,尴尬。。。见鬼。。。 后面补充一些图,如app到Preallocated 的流程,fork过程中各线程重建的过程等 https://blog.csdn.net/zembers/article/details/48519661?utm_source=blogxgwz37   下图来自以上链接,感谢作者: ...

hunter 399

QMT中ContextInfo的使用注意

QMT中ContextInfo下声明的全局变量的使用注意事项

路在何方 2826

软考高级:政府信息化与电子政务(G2G 、G2E、G2B、B2G、G2C、C2C)概念和例题

明明如月学长, CSDN 博客专家,大厂高级 Java 工程师,《性能优化方法论》作者、《解锁大厂思维:剖析《阿里巴巴Java开发手册》》、《再学经典:《Effective Java》独家解析》专栏作者。

悟鸣的技术博客 3951

Qt 5.9.1 32位下,手把手搞定周立功CAN二次开发库的加载与配置(含常见错误排查)

本文详细介绍了在Qt 5.9.1 32位环境下配置周立功CAN二次开发库的完整流程,包括环境准备、项目配置、常见错误排查及性能优化建议。特别针对MinGW 32bit环境,提供了.pro文件的精准配置和DLL部署策略,帮助开发者快速解决库文件匹配、编译报错和运行时问题,实现高效的CAN总线通信开发。

weixin_28717431的博客 359

机器学习kaggle报告-Facial Keypoints Detection【完整解题过程+代码】

在处理面部关键点检测任务时,首先需要将存储在 CSV 文件中的图像数据转换为可以显示和分析的图像。数据集中每个图像是以一个一维数组的形式存储,其中包含了图像的所有像素值。为了将这些数据转化为实际的图像,我们需要按照一定的规则将这些像素值重新排列为一个二维矩阵(即图像的行列)。下面是一个案例,展示了如何将数据集中的图像数据转化为图片。转化过程读取CSV文件:首先,我们需要读取包含图像数据的 CSV 文件,通常该文件包含多张图像的像素值。每一行表示一张图像,并且包含图像的像素值列表。提取图像数据。

一键难忘的博客 3363

产品之 2B、2C与2G

文章目录TL;DR1 相同之处2 不同之处3 G 端产品的特点4 政府领导型客户频繁变更需求怎么办?三个步骤解决! TL;DR B2B(business to business,企业对企业)、B2C(business to customer,企业对消费者)、B2H(business to home)、C2C(customer to customer消费者对消费者)、B2G(business to government 企业对政府的电子商务模式) To C面向个人用户;To B面向企业;To G面向政府(使

既然青春留不住,还是做个大叔好! 6308

deepstream车道线检测自定义插件化,其中要注意pipeline的配置,如果插件位置配置不对,会报input format should be RGBA when using blur-obje

以上代码中,我们先从对象池中获取一个 DsUserMeta 对象,然后使用 get_lane_line_from_frame 函数获取车道线检测结果,并使用 add_lane_line_meta 函数将其添加到 DsUserMeta 对象中。注意,上述代码中的 get_lane_line_from_frame 函数和 add_lane_line_meta 函数需要你自己实现,用于从视频帧中提取车道线检测结果,并将其添加到 DsUserMeta 中。

pvmsmfchcs的博客 694

ffos : b2g loader main到b2g_main

fork 之后分两条线, b2g 进程: main(b2g process)--&gt; b2g_main---&gt;do_main--&gt; startup xpcom 的过程: main()-&gt;RunProcesses()-&gt;b2g_main()-&gt;do_main()-&gt;XRE_main-&gt;ScopedXPCOMStartup::Initialize(...

hunter 358

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

b2g 启动Log分析:b2g,nuwa,preallocated,app

https://blog.csdn.net/hunter___/article/details/83016461 https://blog.csdn.net/hunter___/article/details/83022983     b2g 进程主线程b2g thread 经过b2g loader,保存或加载各必备资源,完成后。开始runprocess,即开始运行新的进程,开始fork操...

hunter 311

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

B2G:来自Web平台的挑战者

iOS和Android已成为移动平台的两大帝国,而由Mozilla和著名运营商Telefonica共同开发的新的操作系统—B2G,从诞生开始,就肩负着瓦解苹果和Google垄断地位的使命。 B2G是什么? B2G全称为Boot to Gecko。众所周知,Gecko是互联网中是最流行的排版引擎之一(Mozilla家族浏览器以及Netscape 6以后版本浏览器所使用),而Boot to Gecko...

《程序员》官方BLOG 945

【电子政务模式:G2B、G2C、G2E、G2G】

【代码】【电子政务模式:G2B、G2C、G2E、G2G】

等待着风的博客 2701

ffos:B2G IPC internals,nuwa process and b2g process

https://developer.mozilla.org/en-US/docs/Archive/B2G_OS/Security/B2G_IPC_internals Architecture In FirefoxOS we have a Multi-process Architecture where the apps on the phone are running in a differ...

hunter 334

B2B,B2C,C2C,C2B,B2G 之间的区别

B2B (Business to Business)  是指 商家 与商家建立的商业关系 .  例如我们在麦当劳中只能 够买到可口可乐是因为麦当劳与可口可乐中的商业伙伴的关系 .  商家们建立商业伙伴的关 系是希望通过大家所提供的东西来形成一个互补的发展机会 , 大家的生意都可以有利润 .  例:

静下心来写代码 5421

Firefox OS 学习——B2G 源码获取和build code

参考文章:Building and installing Firefox OS 这篇文件简单说下,自己实践获取B2G的源码并编译。 硬件要求:     1. An installed 64 bit GNU/Linux distribution (we recommend Ubuntu 12.04).     2. At least 4 GB of RAM/swap space.

Carson IT之旅 8073
上一篇: repost:一个极其简陋的C/C++日志工具
下一篇: repost:Android shell 下 busybox,clear,tcpdump、、众多命令的移植
nedwons
博客等级 码龄9年 311粉丝 572原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址