[Core] Fix dereference of null pointer in video_bridge_thread() when codec b is not yet initialized.
This commit is contained in:
parent
4589a47324
commit
b847935ce2
|
@ -175,9 +175,6 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
|
||||||
|
|
||||||
while (switch_channel_up_nosig(channel) && switch_channel_up_nosig(b_channel) && vh->up == 1) {
|
while (switch_channel_up_nosig(channel) && switch_channel_up_nosig(b_channel) && vh->up == 1) {
|
||||||
if (switch_channel_media_up(channel)) {
|
if (switch_channel_media_up(channel)) {
|
||||||
switch_codec_t *a_codec = switch_core_session_get_video_read_codec(vh->session_a);
|
|
||||||
switch_codec_t *b_codec = switch_core_session_get_video_write_codec(vh->session_b);
|
|
||||||
|
|
||||||
if (switch_core_session_transcoding(vh->session_a, vh->session_b, SWITCH_MEDIA_TYPE_VIDEO)) {
|
if (switch_core_session_transcoding(vh->session_a, vh->session_b, SWITCH_MEDIA_TYPE_VIDEO)) {
|
||||||
pass_val = 1;
|
pass_val = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -195,11 +192,14 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
|
if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
|
||||||
switch_assert(a_codec);
|
switch_codec_implementation_t session_a_codec_implementation;
|
||||||
switch_assert(b_codec);
|
switch_codec_implementation_t session_b_codec_implementation;
|
||||||
|
|
||||||
|
switch_core_session_get_video_read_impl(vh->session_a, &session_a_codec_implementation);
|
||||||
|
switch_core_session_get_video_write_impl(vh->session_b, &session_b_codec_implementation);
|
||||||
|
|
||||||
if (switch_channel_test_flag(channel, CF_VIDEO_DECODED_READ)) {
|
if (switch_channel_test_flag(channel, CF_VIDEO_DECODED_READ)) {
|
||||||
if (a_codec->implementation->impl_id == b_codec->implementation->impl_id && !switch_channel_test_flag(b_channel, CF_VIDEO_DECODED_READ)) {
|
if (session_a_codec_implementation.impl_id == session_b_codec_implementation.impl_id && !switch_channel_test_flag(b_channel, CF_VIDEO_DECODED_READ)) {
|
||||||
if (set_decoded_read) {
|
if (set_decoded_read) {
|
||||||
switch_channel_clear_flag_recursive(channel, CF_VIDEO_DECODED_READ);
|
switch_channel_clear_flag_recursive(channel, CF_VIDEO_DECODED_READ);
|
||||||
set_decoded_read = 0;
|
set_decoded_read = 0;
|
||||||
|
@ -207,7 +207,7 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (a_codec->implementation->impl_id != b_codec->implementation->impl_id ||
|
if (session_a_codec_implementation.impl_id != session_b_codec_implementation.impl_id ||
|
||||||
switch_channel_test_flag(b_channel, CF_VIDEO_DECODED_READ)) {
|
switch_channel_test_flag(b_channel, CF_VIDEO_DECODED_READ)) {
|
||||||
switch_channel_set_flag_recursive(channel, CF_VIDEO_DECODED_READ);
|
switch_channel_set_flag_recursive(channel, CF_VIDEO_DECODED_READ);
|
||||||
set_decoded_read = 1;
|
set_decoded_read = 1;
|
||||||
|
|
Loading…
Reference in New Issue