WebRTC在Ubuntu中调试

环境:Ubuntu 16.04

编译器:g++-5.4

设备:需要两个USB摄像头

WebRTC peerconnection在Ubuntu中运行会报错,出现段错误,现针对报错做以下修改。

vi  physical_socket_server.cc +1171 注释检测行代码

//RTC_DCHECK(!waiting_);

//RTC_DCHECK(!*value_);

vi linux/main_wnd.cc

void GtkMainWnd::OnRedraw()
{

   gdk_threads_enter();

    VideoRenderer* remote_renderer = remote_renderer_.get();
    if (remote_renderer && remote_renderer->image() != NULL && draw_area_ != NULL) {
        width_ = remote_renderer->width();
        height_ = remote_renderer->height();
        int width = 640; int height = 480;
        if (!draw_buffer_.get()) {
            draw_buffer_size_ = (width * height) * 4;
            draw_buffer_.reset(new uint8_t[draw_buffer_size_]);
            gtk_widget_set_size_request(draw_area_, width, height);
        }

        const uint32_t* image = reinterpret_cast<const uint32_t*>(remote_renderer->image());
        uint32_t* scaled = reinterpret_cast<uint32_t*>(draw_buffer_.get());
        memset(scaled, 0xff, draw_buffer_size_);
        for (int r = 0; r < height_; r += 1) {
            for (int c = 0; c < width_; c += 1) {
                int x = c / 1;
                scaled[x] = image[c];
            }
            image += width_;
            scaled += width_;
        }
        gtk_widget_queue_draw(draw_area_);
    }

    gdk_threads_leave();
}
void GtkMainWnd::Draw(GtkWidget* widget, cairo_t* cr) {
#if GTK_MAJOR_VERSION != 2
  cairo_format_t format = CAIRO_FORMAT_ARGB32;
  cairo_surface_t* surface = cairo_image_surface_create_for_data(
      draw_buffer_.get(), format, width_ * 1, height_ * 1,
      cairo_format_stride_for_width(format, width_ * 1));
  cairo_set_source_surface(cr, surface, 0, 0);
  cairo_rectangle(cr, 0, 0, width_ * 1, height_ * 1);
  cairo_fill(cr);
  cairo_surface_destroy(surface);
#else
  RTC_DCHECK_NOTREACHED();
#endif
}

 

调试结果

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值