小编And*_*dré的帖子

如何使用 MediaRecorder 作为 MediaSource

作为学习 WebRTC 的练习,我试图展示本地网络摄像头并并排显示网络摄像头的延迟播放。为了实现这一点,我试图将记录的 blob 传递给 BufferSource 并使用相应的 MediaSource 作为视频元素的源。

// the ondataavailable callback for the MediaRecorder
async function handleDataAvailable(event) {
  // console.log("handleDataAvailable", event);
  if (event.data && event.data.size > 0) {
    recordedBlobs.push(event.data);
  }

  if (recordedBlobs.length > 5) {
    if (recordedBlobs.length === 5)
      console.log("buffered enough for delayed playback");
    if (!updatingBuffer) {
      updatingBuffer = true;
      const bufferedBlob = recordedBlobs.shift();
      const bufferedAsArrayBuffer = await bufferedBlob.arrayBuffer();
      if (!sourceBuffer.updating) {
        console.log("appending to buffer");
        sourceBuffer.appendBuffer(bufferedAsArrayBuffer);
      } else {
        console.warn("Buffer still updating... ");
        recordedBlobs.unshift(bufferedBlob);
      }
    }
  }
} …
Run Code Online (Sandbox Code Playgroud)

html javascript webrtc

13
推荐指数
1
解决办法
4808
查看次数

交叉编译提升的麻烦

我正在尝试在我们的系统中设置Boost 1.42.我需要Boost使用gcc编译常规x86架构,我需要交叉编译德州仪器的ARM处理器.

ARM处理器的工具链基于gcc.像gcc,ar,ranlib这样的工具都以arm_v5t_le-为前缀.有关交叉编译的文档有些限制.这就是我所做的:我已经将以下内容添加到user-config.jam文件中:using gcc : arm : arm_v5t_le-g++ ;从我们的Makefile中调用Bjam,如下所示:bjam toolset=gcc-arm --toolset-root=/opt/mv_pro_4.0/montavista/pro/devkit/arm/v5t_le/bin <some other options>为ARM处理器编译,如下所示:bjam toolset=gcc <some other options>对于x86处理器.这里提到选项--toolset-root .

我遇到了以下问题:当我为ARM处理器构建应用程序时,我收到以下链接器错误:libboost_system-mt.a:无法读取符号:存档没有索引; 运行ranlib添加一个.我在存档上运行arm_v5t_le-ranlib后,链接没有问题.我的猜测是bjam使用ar而不是arm-v5t_le-ar.如何告诉bjam应该使用哪个归档器?

邮件列表上,据说<archiver>也在user-config.jam中指定,但遗憾的是它似乎不起作用.我最终得到了相同的链接器错误.

谢谢.

boost cross-compiling

5
推荐指数
1
解决办法
3876
查看次数

boost :: phoenix :: at_c是否有替代boost :: spirit :: qi :: grammar的替代方法

我创建了一个测试应用程序来说明我的问题.它解析前面带有"a ="或"b ="的整数列表,并用"\ r \n"分隔.该列表按任何顺序包含多个这些字段.

#include <string>
#include <vector>
#include <iostream>

#include <boost/spirit/include/qi.hpp>

#include <boost/spirit/include/phoenix.hpp>

#include <boost/fusion/include/adapt_struct.hpp>


typedef std::vector<unsigned int> uint_vector_t;

std::ostream& operator<<(std::ostream& out, const uint_vector_t &data)
{
    for (unsigned int i(0); i < data.size(); i++)
    {
        out << data[i] << '\n';
    }
    return out;
}

struct MyStruct
{
    uint_vector_t m_aList;
    uint_vector_t m_bList;
};

BOOST_FUSION_ADAPT_STRUCT
(
    MyStruct,
    (uint_vector_t, m_aList)
    (uint_vector_t, m_bList)
)
;

template<typename Iterator>
struct MyParser : public boost::spirit::qi::grammar<Iterator,
        MyStruct()>
{
    MyParser() :
        MyParser::base_type(Parser, "Parser")
    {
        using boost::spirit::qi::uint_;
        using …
Run Code Online (Sandbox Code Playgroud)

c++ boost boost-spirit boost-spirit-qi

4
推荐指数
1
解决办法
2554
查看次数