Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
8a79e91e
Commit
8a79e91e
authored
Oct 11, 2019
by
Sylvain Berfini
🐮
Browse files
Fixed android preview ratio
parent
f96369ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
coreapi/linphonecore.c
View file @
8a79e91e
...
...
@@ -5104,13 +5104,25 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) {
void
linphone_core_resize_video_preview
(
LinphoneCore
*
lc
,
int
width
,
int
height
)
{
bool_t
auto_camera_preview_resize
=
!!
lp_config_get_int
(
lc
->
config
,
"video"
,
"auto_resize_preview_to_keep_ratio"
,
0
);
if
(
!
auto_camera_preview_resize
)
return
;
bctbx_message
(
"Resizing video preview to: %ix%i"
,
width
,
height
);
#ifdef VIDEO_ENABLED
bctbx_message
(
"Resizing camera video preview to: %ix%i"
,
width
,
height
);
getPlatformHelpers
(
lc
)
->
resizeVideoPreview
(
width
,
height
);
#endif
}
#ifdef VIDEO_ENABLED
static
void
video_stream_callback
(
void
*
userdata
,
const
MSFilter
*
f
,
const
unsigned
int
id
,
const
void
*
arg
)
{
switch
(
id
)
{
case
MS_CAMERA_PREVIEW_SIZE_CHANGED
:
{
LinphoneCore
*
lc
=
(
LinphoneCore
*
)
userdata
;
MSVideoSize
size
=
*
(
MSVideoSize
*
)
arg
;
bctbx_message
(
"Camera video preview size changed: %ix%i"
,
size
.
width
,
size
.
height
);
linphone_core_resize_video_preview
(
lc
,
size
.
width
,
size
.
height
);
break
;
}
}
}
static
void
video_filter_callback
(
void
*
userdata
,
struct
_MSFilter
*
f
,
unsigned
int
id
,
void
*
arg
)
{
switch
(
id
)
{
case
MS_JPEG_WRITER_SNAPSHOT_TAKEN
:
{
...
...
@@ -5127,13 +5139,6 @@ static void video_filter_callback(void *userdata, struct _MSFilter *f, unsigned
}
break
;
}
case
MS_CAMERA_PREVIEW_SIZE_CHANGED
:
{
MSVideoSize
size
=
*
(
MSVideoSize
*
)
arg
;
bctbx_message
(
"Camera preview size changed: %ix%i"
,
size
.
width
,
size
.
height
);
LinphoneCore
*
lc
=
(
LinphoneCore
*
)
userdata
;
linphone_core_resize_video_preview
(
lc
,
size
.
width
,
size
.
height
);
break
;
}
}
}
#endif
...
...
@@ -5204,9 +5209,7 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val){
if
(
video_preview_qrcode_enabled
(
lc
->
previewstream
))
{
ms_filter_add_notify_callback
(
lc
->
previewstream
->
qrcode
,
video_filter_callback
,
lc
,
TRUE
);
}
MSVideoSize
size
=
video_preview_get_current_size
(
lc
->
previewstream
);
linphone_core_resize_video_preview
(
lc
,
size
.
width
,
size
.
height
);
ms_filter_add_notify_callback
(
lc
->
previewstream
->
source
,
video_filter_callback
,
lc
,
TRUE
);
video_stream_set_event_callback
(
lc
->
previewstream
,
video_stream_callback
,
lc
);
}
}
else
{
if
(
lc
->
previewstream
!=
NULL
)
{
...
...
src/conference/session/media-session.cpp
View file @
8a79e91e
...
...
@@ -3374,20 +3374,6 @@ void MediaSessionPrivate::startTextStream () {
lInfo
()
<<
"No valid text stream defined"
;
}
#ifdef VIDEO_ENABLED
static
void
video_filter_callback
(
void
*
userdata
,
struct
_MSFilter
*
f
,
unsigned
int
id
,
void
*
arg
)
{
switch
(
id
)
{
case
MS_CAMERA_PREVIEW_SIZE_CHANGED
:
{
MSVideoSize
size
=
*
(
MSVideoSize
*
)
arg
;
bctbx_message
(
"Camera preview size changed: %ix%i"
,
size
.
width
,
size
.
height
);
LinphoneCore
*
lc
=
(
LinphoneCore
*
)
userdata
;
linphone_core_resize_video_preview
(
lc
,
size
.
width
,
size
.
height
);
break
;
}
}
}
#endif
void
MediaSessionPrivate
::
startVideoStream
(
CallSession
::
State
targetState
)
{
#ifdef VIDEO_ENABLED
L_Q
();
...
...
@@ -3505,12 +3491,6 @@ void MediaSessionPrivate::startVideoStream (CallSession::State targetState) {
}
}
if
(
videoStream
->
source
)
{
MSVideoSize
size
=
video_preview_get_current_size
(
videoStream
);
linphone_core_resize_video_preview
(
q
->
getCore
()
->
getCCore
(),
size
.
width
,
size
.
height
);
ms_filter_add_notify_callback
(
videoStream
->
source
,
video_filter_callback
,
q
->
getCore
()
->
getCCore
(),
FALSE
);
}
ms_media_stream_sessions_set_encryption_mandatory
(
&
videoStream
->
ms
.
sessions
,
isEncryptionMandatory
());
if
(
listener
)
listener
->
onResetFirstVideoFrameDecoded
(
q
->
getSharedFromThis
());
...
...
@@ -4494,6 +4474,12 @@ void MediaSessionPrivate::videoStreamEventCb (const MSFilter *f, const unsigned
case
MS_VIDEO_DECODER_SEND_RPSI
:
/* Handled internally by mediastreamer2 */
break
;
case
MS_CAMERA_PREVIEW_SIZE_CHANGED
:
{
MSVideoSize
size
=
*
(
MSVideoSize
*
)
args
;
lInfo
()
<<
"Camera video preview size changed: "
<<
size
.
width
<<
"x"
<<
size
.
height
;
linphone_core_resize_video_preview
(
q
->
getCore
()
->
getCCore
(),
size
.
width
,
size
.
height
);
break
;
}
default:
lWarning
()
<<
"Unhandled event "
<<
eventId
;
break
;
...
...
@@ -5016,7 +5002,6 @@ LinphoneStatus MediaSession::update (const MediaSessionParams *msp, const string
video_stream_change_camera
(
d
->
videoStream
,
getCore
()
->
getCCore
()
->
video_conf
.
device
);
else
video_stream_update_video_params
(
d
->
videoStream
);
linphone_core_resize_video_preview
(
getCore
()
->
getCCore
(),
vsize
.
width
,
vsize
.
height
);
}
#endif
}
...
...
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