]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7002 #resolve #comment please verify
authorAnthony Minessale <anthm@freeswitch.org>
Sat, 6 Dec 2014 01:18:28 +0000 (19:18 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Sat, 6 Dec 2014 01:18:28 +0000 (19:18 -0600)
src/switch_core_media_bug.c
src/switch_ivr_async.c

index 6e9d746ac0fc4e6c7edc0682c2aca093284ce11c..08f2ee30d781b652277d5f64835df252a0ee6e74 100644 (file)
@@ -227,9 +227,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
        if (bug->record_frame_size && bug->record_pre_buffer_max && (do_read || do_write) && bug->record_pre_buffer_count < bug->record_pre_buffer_max) {
                bug->record_pre_buffer_count++;
                return SWITCH_STATUS_FALSE;
-       }
-
-       if (!bug->record_frame_size) {
+       } else {
                uint32_t frame_size;
                switch_codec_implementation_t read_impl = { 0 };
                //switch_codec_implementation_t other_read_impl = { 0 };
@@ -238,6 +236,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
                switch_core_session_get_read_impl(bug->session, &read_impl);
                frame_size = read_impl.decoded_bytes_per_packet;
                bug->record_frame_size = frame_size;
+               
 #if 0
                if (do_read && do_write) {                      
                        if (switch_core_session_get_partner(bug->session, &other_session) == SWITCH_STATUS_SUCCESS) {
@@ -255,7 +254,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
                                }
                        }
 
-                       bug->record_frame_size = frame_size;
+                       bug->record_frame_size = bytes = frame_size;
                }
 #endif
        }
@@ -278,7 +277,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
        fill_read = !do_read;
        fill_write = !do_write;
 
-       if (fill_read && fill_write) {
+       if ((fill_read && fill_write) || (!fill && fill_read)) {
                return SWITCH_STATUS_FALSE;
        }
 
index 25ec4d7285a5e9d1998a147312d556ec77fb3418..3d3509b09125cab0f9adb4eae37b97abceff751a 100644 (file)
@@ -1313,12 +1313,13 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
                        uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
                        switch_frame_t frame = { 0 };
                        switch_status_t status;
+                       int x = 0;
 
                        frame.data = data;
                        frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
 
                        for (;;) {
-                               status = switch_core_media_bug_read(bug, &frame, SWITCH_FALSE);
+                               status = switch_core_media_bug_read(bug, &frame, x++ == 0);
 
                                if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) {