Skip to content

Instantly share code, notes, and snippets.

@thebongy
Created November 3, 2022 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebongy/fecccfe8b57a39430ac9c051eeff25db to your computer and use it in GitHub Desktop.
Save thebongy/fecccfe8b57a39430ac9c051eeff25db to your computer and use it in GitHub Desktop.
diff --git a/examples/peerconnection/client/linux/main_wnd.cc b/examples/peerconnection/client/linux/main_wnd.cc
index 2be75d8f8d..a1581c67d5 100644
--- a/examples/peerconnection/client/linux/main_wnd.cc
+++ b/examples/peerconnection/client/linux/main_wnd.cc
@@ -429,8 +429,10 @@ void GtkMainWnd::OnRedraw() {
width_ = remote_renderer->width();
height_ = remote_renderer->height();
- if (!draw_buffer_.get()) {
- draw_buffer_size_ = (width_ * height_ * 4) * 4;
+ int size = (width_ * height_ * 4) * 4;
+
+ if (!draw_buffer_.get() || size != draw_buffer_size_) {
+ draw_buffer_size_ = size;
draw_buffer_.reset(new uint8_t[draw_buffer_size_]);
gtk_widget_set_size_request(draw_area_, width_ * 2, height_ * 2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment