当前位置:   article > 正文

WebRTC在Ubuntu中调试_ubuntu 调试webrtc peerconnection

ubuntu 调试webrtc peerconnection

环境:Ubuntu 16.04

编译器:g++-5.4

设备:需要两个USB摄像头

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

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

  1. //RTC_DCHECK(!waiting_);
  2. //RTC_DCHECK(!*value_);

vi linux/main_wnd.cc

  1. void GtkMainWnd::OnRedraw()
  2. {
  3. gdk_threads_enter();
  4. VideoRenderer* remote_renderer = remote_renderer_.get();
  5. if (remote_renderer && remote_renderer->image() != NULL && draw_area_ != NULL) {
  6. width_ = remote_renderer->width();
  7. height_ = remote_renderer->height();
  8. int width = 640; int height = 480;
  9. if (!draw_buffer_.get()) {
  10. draw_buffer_size_ = (width * height) * 4;
  11. draw_buffer_.reset(new uint8_t[draw_buffer_size_]);
  12. gtk_widget_set_size_request(draw_area_, width, height);
  13. }
  14. const uint32_t* image = reinterpret_cast<const uint32_t*>(remote_renderer->image());
  15. uint32_t* scaled = reinterpret_cast<uint32_t*>(draw_buffer_.get());
  16. memset(scaled, 0xff, draw_buffer_size_);
  17. for (int r = 0; r < height_; r += 1) {
  18. for (int c = 0; c < width_; c += 1) {
  19. int x = c / 1;
  20. scaled[x] = image[c];
  21. }
  22. image += width_;
  23. scaled += width_;
  24. }
  25. gtk_widget_queue_draw(draw_area_);
  26. }
  27. gdk_threads_leave();
  28. }
  1. void GtkMainWnd::Draw(GtkWidget* widget, cairo_t* cr) {
  2. #if GTK_MAJOR_VERSION != 2
  3. cairo_format_t format = CAIRO_FORMAT_ARGB32;
  4. cairo_surface_t* surface = cairo_image_surface_create_for_data(
  5. draw_buffer_.get(), format, width_ * 1, height_ * 1,
  6. cairo_format_stride_for_width(format, width_ * 1));
  7. cairo_set_source_surface(cr, surface, 0, 0);
  8. cairo_rectangle(cr, 0, 0, width_ * 1, height_ * 1);
  9. cairo_fill(cr);
  10. cairo_surface_destroy(surface);
  11. #else
  12. RTC_DCHECK_NOTREACHED();
  13. #endif
  14. }

 

调试结果

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/850929
推荐阅读
相关标签
  

闽ICP备14008679号