mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
FS-9924: Removed extra space in source files
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Michael Jerris <mike@jerris.com>
|
||||
* Paul D. Tinsley <pdt at jackhammer.org>
|
||||
@@ -208,10 +208,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
|
||||
}
|
||||
|
||||
if ((!bug->raw_read_buffer && (!bug->raw_write_buffer || !switch_test_flag(bug, SMBF_WRITE_STREAM)))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_ERROR,
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_ERROR,
|
||||
"%s Buffer Error (raw_read_buffer=%p, raw_write_buffer=%p, read=%s, write=%s)\n",
|
||||
switch_channel_get_name(bug->session->channel),
|
||||
(void *)bug->raw_read_buffer, (void *)bug->raw_write_buffer,
|
||||
(void *)bug->raw_read_buffer, (void *)bug->raw_write_buffer,
|
||||
switch_test_flag(bug, SMBF_READ_STREAM) ? "yes" : "no",
|
||||
switch_test_flag(bug, SMBF_WRITE_STREAM) ? "yes" : "no");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
@@ -241,7 +241,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
|
||||
} else {
|
||||
uint32_t frame_size;
|
||||
switch_codec_implementation_t read_impl = { 0 };
|
||||
|
||||
|
||||
switch_core_session_get_read_impl(bug->session, &read_impl);
|
||||
frame_size = read_impl.decoded_bytes_per_packet;
|
||||
bug->record_frame_size = frame_size;
|
||||
@@ -290,7 +290,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
|
||||
if (do_write && do_write > SWITCH_RECOMMENDED_BUFFER_SIZE) {
|
||||
do_write = 1280;
|
||||
}
|
||||
|
||||
|
||||
if (do_read) {
|
||||
switch_mutex_lock(bug->read_mutex);
|
||||
frame->datalen = (uint32_t) switch_buffer_read(bug->raw_read_buffer, frame->data, do_read);
|
||||
@@ -359,7 +359,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
|
||||
} else {
|
||||
for (x = 0; x < blen; x++) {
|
||||
int32_t w = 0, r = 0, z = 0;
|
||||
|
||||
|
||||
if (x < rlen) {
|
||||
r = (int32_t) * (fp + x);
|
||||
}
|
||||
@@ -367,7 +367,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
|
||||
if (x < wlen) {
|
||||
w = (int32_t) * (dp + x);
|
||||
}
|
||||
|
||||
|
||||
z = w + r;
|
||||
|
||||
if (z > SWITCH_SMAX || z < SWITCH_SMIN) {
|
||||
@@ -431,7 +431,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_patch_spy_frame(switch_med
|
||||
switch_queue_create(&bug->spy_video_queue[i], SWITCH_CORE_QUEUE_LEN, switch_core_session_get_pool(bug->session));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
spy_q = bug->spy_video_queue[rw];
|
||||
|
||||
while(switch_queue_size(spy_q) > 0) {
|
||||
@@ -461,7 +461,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_patch_spy_frame(switch_med
|
||||
if ((float)w/h == aspect169) {
|
||||
if ((float)bug->spy_img[rw]->d_w / bug->spy_img[rw]->d_h == aspect169) {
|
||||
spy_tmp = switch_img_copy_rect(bug->spy_img[rw], bug->spy_img[rw]->d_w / 4, 0, bug->spy_img[rw]->d_w / 2, bug->spy_img[rw]->d_h);
|
||||
|
||||
|
||||
} else {
|
||||
switch_img_copy(bug->spy_img[rw], &spy_tmp);
|
||||
}
|
||||
@@ -507,10 +507,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_patch_spy_frame(switch_med
|
||||
|
||||
spyw = (int) (float)w * scaler;
|
||||
spyh = (int) (float)h * scaler;
|
||||
|
||||
|
||||
if (bug->spy_img[rw]->d_w != spyw || bug->spy_img[rw]->d_h != spyh) {
|
||||
switch_image_t *tmp_img = NULL;
|
||||
|
||||
|
||||
switch_img_scale(bug->spy_img[rw], &tmp_img, spyw, spyh);
|
||||
switch_img_free(&bug->spy_img[rw]);
|
||||
bug->spy_img[rw] = tmp_img;
|
||||
@@ -535,7 +535,7 @@ static void *SWITCH_THREAD_FUNC video_bug_thread(switch_thread_t *thread, void *
|
||||
void *pop;
|
||||
uint8_t *buf;
|
||||
switch_size_t buflen = SWITCH_RTP_MAX_BUF_LEN;
|
||||
switch_frame_t frame = { 0 };
|
||||
switch_frame_t frame = { 0 };
|
||||
|
||||
buf = switch_core_session_alloc(bug->session, buflen);
|
||||
frame.packet = buf;
|
||||
@@ -560,16 +560,16 @@ static void *SWITCH_THREAD_FUNC video_bug_thread(switch_thread_t *thread, void *
|
||||
switch_status_t status;
|
||||
int w = 0, h = 0, ok = 1;
|
||||
|
||||
|
||||
|
||||
if ((status = switch_queue_pop(main_q, &pop)) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_img_free(&img);
|
||||
|
||||
|
||||
if (!pop) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
img = (switch_image_t *) pop;
|
||||
|
||||
|
||||
w = img->d_w;
|
||||
h = img->d_h;
|
||||
|
||||
@@ -586,15 +586,15 @@ static void *SWITCH_THREAD_FUNC video_bug_thread(switch_thread_t *thread, void *
|
||||
if (other_img) {
|
||||
if (other_img->d_w != w || other_img->d_h != h) {
|
||||
switch_image_t *tmp_img = NULL;
|
||||
|
||||
|
||||
switch_img_scale(other_img, &tmp_img, w, h);
|
||||
switch_img_free(&other_img);
|
||||
other_img = tmp_img;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
w *= 2;
|
||||
|
||||
|
||||
if (!IMG || IMG->d_h != h || IMG->d_w != w) {
|
||||
switch_img_free(&IMG);
|
||||
IMG = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, w, h, 1);
|
||||
@@ -672,8 +672,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
|
||||
const char *function,
|
||||
const char *target,
|
||||
switch_media_bug_callback_t callback,
|
||||
void *user_data, time_t stop_time,
|
||||
switch_media_bug_flag_t flags,
|
||||
void *user_data, time_t stop_time,
|
||||
switch_media_bug_flag_t flags,
|
||||
switch_media_bug_t **new_bug)
|
||||
{
|
||||
switch_media_bug_t *bug, *bp;
|
||||
@@ -690,12 +690,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
|
||||
if (!zstr(bp->function) && !strcasecmp(function, bp->function)) {
|
||||
punt = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch_thread_rwlock_unlock(session->bug_rwlock);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (punt) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Only one bug of this type allowed!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
@@ -763,7 +763,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
|
||||
if (target) {
|
||||
bug->target = switch_core_session_strdup(session, target);
|
||||
}
|
||||
|
||||
|
||||
bug->stop_time = stop_time;
|
||||
bytes = bug->read_impl.decoded_bytes_per_packet;
|
||||
|
||||
@@ -801,7 +801,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
|
||||
switch_buffer_create_dynamic(&bug->text_buffer, 512, 1024, 0);
|
||||
switch_zmalloc(bug->text_framedata, 1024);
|
||||
bug->text_framesize = 1024;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ((switch_test_flag(bug, SMBF_READ_VIDEO_STREAM) || switch_test_flag(bug, SMBF_WRITE_VIDEO_STREAM))) {
|
||||
@@ -816,7 +816,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (bug->callback) {
|
||||
switch_bool_t result = bug->callback(bug, bug->user_data, SWITCH_ABC_TYPE_INIT);
|
||||
if (result == SWITCH_FALSE) {
|
||||
@@ -834,7 +834,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
|
||||
switch_memory_pool_t *pool = switch_core_session_get_pool(session);
|
||||
switch_threadattr_create(&thd_attr, pool);
|
||||
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
||||
switch_thread_create(&bug->video_bug_thread, thd_attr, video_bug_thread, bug, pool);
|
||||
switch_thread_create(&bug->video_bug_thread, thd_attr, video_bug_thread, bug, pool);
|
||||
|
||||
}
|
||||
|
||||
@@ -846,7 +846,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
|
||||
for(bp = session->bugs; bp; bp = bp->next) {
|
||||
if (bp->ready && !switch_test_flag(bp, SMBF_TAP_NATIVE_READ) && !switch_test_flag(bp, SMBF_TAP_NATIVE_WRITE)) {
|
||||
tap_only = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch_thread_rwlock_unlock(session->bug_rwlock);
|
||||
@@ -901,7 +901,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_recordings(switch
|
||||
const char *save_stereo = switch_channel_get_variable(new_channel, "record_stereo");
|
||||
const char *orig_stereo = switch_channel_get_variable(orig_channel, "record_stereo");
|
||||
const char *new_stereo = orig_stereo;
|
||||
|
||||
|
||||
switch_thread_rwlock_wrlock(orig_session->bug_rwlock);
|
||||
switch_channel_set_variable(new_channel, "RECORD_MIN_SEC", "0");
|
||||
switch_channel_set_variable(new_channel, "record_append", "true");
|
||||
@@ -935,7 +935,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_recordings(switch
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_callback(switch_core_session_t *orig_session, switch_core_session_t *new_session,
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_callback(switch_core_session_t *orig_session, switch_core_session_t *new_session,
|
||||
switch_media_bug_callback_t callback, void * (*user_data_dup_func) (switch_core_session_t *, void *))
|
||||
{
|
||||
switch_media_bug_t *new_bug = NULL, *cur = NULL, *bp = NULL, *last = NULL;
|
||||
@@ -946,7 +946,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_callback(switch_c
|
||||
while (bp) {
|
||||
cur = bp;
|
||||
bp = bp->next;
|
||||
|
||||
|
||||
if (cur->callback == callback) {
|
||||
if (last) {
|
||||
last->next = cur->next;
|
||||
@@ -1057,7 +1057,7 @@ SWITCH_DECLARE(uint32_t) switch_core_media_bug_patch_video(switch_core_session_t
|
||||
return x;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_exec_all(switch_core_session_t *orig_session,
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_exec_all(switch_core_session_t *orig_session,
|
||||
const char *function, switch_media_bug_exec_cb_t cb, void *user_data)
|
||||
{
|
||||
switch_media_bug_t *bp;
|
||||
@@ -1089,12 +1089,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_sess
|
||||
switch_thread_rwlock_rdlock(session->bug_rwlock);
|
||||
for (bp = session->bugs; bp; bp = bp->next) {
|
||||
int thread_locked = (bp->thread_id && bp->thread_id == switch_thread_self());
|
||||
stream->write_function(stream,
|
||||
stream->write_function(stream,
|
||||
" <media-bug>\n"
|
||||
" <function>%s</function>\n"
|
||||
" <target>%s</target>\n"
|
||||
" <thread-locked>%d</thread-locked>\n"
|
||||
" </media-bug>\n",
|
||||
" </media-bug>\n",
|
||||
bp->function, bp->target, thread_locked);
|
||||
|
||||
}
|
||||
@@ -1102,7 +1102,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_sess
|
||||
}
|
||||
|
||||
stream->write_function(stream, "</media-bugs>\n");
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1114,13 +1114,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all_function(switch
|
||||
if (session->bugs) {
|
||||
switch_thread_rwlock_wrlock(session->bug_rwlock);
|
||||
for (bp = session->bugs; bp; bp = bp->next) {
|
||||
if (!switch_test_flag(session, SSF_DESTROYABLE) &&
|
||||
if (!switch_test_flag(session, SSF_DESTROYABLE) &&
|
||||
((bp->thread_id && bp->thread_id != switch_thread_self()) || switch_test_flag(bp, SMBF_LOCK))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "BUG is thread locked skipping.\n");
|
||||
last = bp;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!zstr(function) && strcmp(bp->function, function)) {
|
||||
last = bp;
|
||||
continue;
|
||||
@@ -1196,7 +1196,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_close(switch_media_bug_t *
|
||||
if (bp->read_video_queue) {
|
||||
switch_queue_push(bp->read_video_queue, NULL);
|
||||
}
|
||||
|
||||
|
||||
if (bp->write_video_queue) {
|
||||
switch_queue_push(bp->write_video_queue, NULL);
|
||||
}
|
||||
@@ -1248,10 +1248,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(switch_core_session
|
||||
for(bp2 = session->bugs; bp2; bp2 = bp2->next) {
|
||||
if (bp2->ready && !switch_test_flag(bp2, SMBF_TAP_NATIVE_READ) && !switch_test_flag(bp2, SMBF_TAP_NATIVE_WRITE)) {
|
||||
tap_only = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (tap_only) {
|
||||
switch_set_flag(session, SSF_MEDIA_BUG_TAP_ONLY);
|
||||
} else {
|
||||
@@ -1263,7 +1263,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(switch_core_session
|
||||
if (bp) {
|
||||
status = switch_core_media_bug_close(&bp);
|
||||
}
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -1305,7 +1305,7 @@ SWITCH_DECLARE(uint32_t) switch_core_media_bug_prune(switch_core_session_t *sess
|
||||
ttl++;
|
||||
goto top;
|
||||
}
|
||||
|
||||
|
||||
return ttl;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user