Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
J
jami-client-gnome
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
152
Issues
152
List
Boards
Labels
Service Desk
Milestones
Iterations
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
savoirfairelinux
jami-client-gnome
Commits
58f10a95
Commit
58f10a95
authored
Nov 11, 2019
by
Sébastien Blin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
video_record: wait that preview is ready before recording
Change-Id: I87feb5979b5ef858df4fa88e20fc1f18d82babf4
parent
90c367e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
17 deletions
+34
-17
src/chatview.cpp
src/chatview.cpp
+34
-17
No files found.
src/chatview.cpp
View file @
58f10a95
...
...
@@ -109,6 +109,7 @@ struct _ChatViewPrivate
bool
ready_
{
false
};
bool
readyToRecord_
{
false
};
bool
useDarkTheme
{
false
};
bool
startRecorderWhenReady
{
false
};
std
::
string
background
;
CppImpl
*
cpp
;
...
...
@@ -462,33 +463,45 @@ on_timer_duration_timeout(ChatView* view)
return
G_SOURCE_CONTINUE
;
}
static
void
reset_recorder
(
ChatView
*
self
)
static
bool
start_recorder
(
ChatView
*
self
)
{
g_return_
if_fail
(
IS_CHAT_VIEW
(
self
)
);
g_return_
val_if_fail
(
IS_CHAT_VIEW
(
self
),
false
);
auto
*
priv
=
CHAT_VIEW_GET_PRIVATE
(
self
);
gtk_widget_hide
(
GTK_WIDGET
(
priv
->
button_retry
));
std
::
string
rsc
=
!
priv
->
useDarkTheme
&&
!
priv
->
is_video_record
?
"/net/jami/JamiGnome/stop"
:
"/net/jami/JamiGnome/stop-white"
;
auto
image
=
gtk_image_new_from_resource
(
rsc
.
c_str
());
gtk_button_set_image
(
GTK_BUTTON
(
priv
->
button_main_action
),
image
);
gtk_widget_set_tooltip_text
(
priv
->
button_main_action
,
_
(
"Stop"
));
priv
->
cpp
->
current_action_
=
RecordAction
::
STOP
;
gtk_label_set_text
(
GTK_LABEL
(
priv
->
label_time
),
"00:00"
);
priv
->
duration
=
0
;
priv
->
timer_duration
=
g_timeout_add
(
1000
,
(
GSourceFunc
)
on_timer_duration_timeout
,
self
);
std
::
string
file_name
=
priv
->
cpp
->
avModel_
->
startLocalRecorder
(
!
priv
->
is_video_record
);
if
(
file_name
.
empty
())
{
g_warning
(
"set_state: failed to start recording"
);
return
;
priv
->
startRecorderWhenReady
=
true
;
g_warning
(
"set_state: failed to start recording, wait preview"
);
return
false
;
}
if
(
!
priv
->
cpp
->
saveFileName_
.
empty
())
{
std
::
remove
(
priv
->
cpp
->
saveFileName_
.
c_str
());
}
priv
->
cpp
->
saveFileName_
=
file_name
;
return
true
;
}
static
void
reset_recorder
(
ChatView
*
self
)
{
g_return_if_fail
(
IS_CHAT_VIEW
(
self
));
auto
*
priv
=
CHAT_VIEW_GET_PRIVATE
(
self
);
auto
result
=
start_recorder
(
self
);
if
(
result
)
{
gtk_widget_hide
(
GTK_WIDGET
(
priv
->
button_retry
));
std
::
string
rsc
=
!
priv
->
useDarkTheme
&&
!
priv
->
is_video_record
?
"/net/jami/JamiGnome/stop"
:
"/net/jami/JamiGnome/stop-white"
;
auto
image
=
gtk_image_new_from_resource
(
rsc
.
c_str
());
gtk_button_set_image
(
GTK_BUTTON
(
priv
->
button_main_action
),
image
);
gtk_widget_set_tooltip_text
(
priv
->
button_main_action
,
_
(
"Stop"
));
priv
->
cpp
->
current_action_
=
RecordAction
::
STOP
;
gtk_label_set_text
(
GTK_LABEL
(
priv
->
label_time
),
"00:00"
);
priv
->
duration
=
0
;
priv
->
timer_duration
=
g_timeout_add
(
1000
,
(
GSourceFunc
)
on_timer_duration_timeout
,
self
);
}
}
static
void
...
...
@@ -1015,6 +1028,7 @@ init_video_widget(ChatView* self)
{
ChatViewPrivate
*
priv
=
CHAT_VIEW_GET_PRIVATE
(
self
);
if
(
priv
->
video_widget
&&
GTK_IS_WIDGET
(
priv
->
video_widget
))
gtk_widget_destroy
(
priv
->
video_widget
);
priv
->
startRecorderWhenReady
=
false
;
priv
->
video_widget
=
video_widget_new
();
try
{
...
...
@@ -1039,6 +1053,9 @@ init_video_widget(ChatView* self)
VIDEO_WIDGET
(
priv
->
video_widget
),
priv
->
cpp
->
avModel_
,
previewRenderer
,
VIDEO_RENDERER_REMOTE
);
// Start recorder
if
(
priv
->
startRecorderWhenReady
)
reset_recorder
(
self
);
});
}
}
catch
(
const
std
::
out_of_range
&
e
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment