Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cefsrc: Clean up CEF object refs #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion gstcefsrc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <include/base/cef_bind.h>
#include <include/base/cef_callback_helpers.h>
#include <include/wrapper/cef_closure_task.h>
#include <include/wrapper/cef_message_router.h>

#include "gstcefsrc.h"
#include "gstcefaudiometa.h"
Expand Down Expand Up @@ -907,6 +906,7 @@ gst_cef_src_start(GstBaseSrc *base_src)

GST_OBJECT_LOCK (src);
src->n_frames = 0;
src->client = browserClient;
GST_OBJECT_UNLOCK (src);

GST_ELEMENT_PROGRESS(src, CONTINUE, "open", ("Creating CEF browser ..."));
Expand Down Expand Up @@ -967,6 +967,8 @@ gst_cef_src_stop (GstBaseSrc *base_src)
{
GstCefSrc *src = GST_CEF_SRC (base_src);

GST_OBJECT_LOCK (src);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Taking the object lock then waiting is a bit awkward, it could mean an for instance an application potentially blocking while trying to set a property from its main thread


GST_INFO_OBJECT (src, "Stopping");

if (src->browser) {
Expand All @@ -986,6 +988,8 @@ gst_cef_src_stop (GstBaseSrc *base_src)

gst_buffer_replace (&src->current_buffer, NULL);

GST_OBJECT_UNLOCK (src);

return TRUE;
}

Expand Down Expand Up @@ -1236,6 +1240,9 @@ gst_cef_src_finalize (GObject *object)
g_free (src->js_flags);
g_free (src->cef_cache_location);

// free client
src->client->Release();

g_cond_clear(&src->state_cond);
g_mutex_clear(&src->state_lock);
}
Expand Down
5 changes: 3 additions & 2 deletions gstcefsrc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define __GST_CEF_SRC_H__

#include "include/cef_browser_process_handler.h"
#include "include/internal/cef_ptr.h"
#include <gst/gst.h>
#include <gst/base/gstpushsrc.h>
#include <gst/video/video.h>
Expand All @@ -11,7 +12,7 @@
#include <include/cef_life_span_handler.h>
#include <include/cef_load_handler.h>
#include <include/wrapper/cef_helpers.h>

#include <include/wrapper/cef_message_router.h>

G_BEGIN_DECLS

Expand Down Expand Up @@ -61,7 +62,7 @@ struct _GstCefSrc {
gboolean listen_for_js_signals;
gint chromium_debug_port;
CefRefPtr<CefBrowser> browser;
CefRefPtr<CefApp> app;
CefRefPtr<CefClient> client;

GCond state_cond;
GMutex state_lock;
Expand Down
Loading