]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7500: add SFF_USE_VIDEO_TIMESTAMP to tell video write frame if it needs to use...
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 18 Nov 2014 23:36:55 +0000 (17:36 -0600)
committerMichael Jerris <mike@jerris.com>
Thu, 28 May 2015 17:46:45 +0000 (12:46 -0500)
src/include/switch_types.h
src/mod/codecs/mod_openh264/mod_openh264.cpp
src/mod/codecs/mod_vpx/mod_vpx.c
src/switch_core_media.c

index 93071b8406d614c4b2e67b80879afb3b60544529..bc544a342674c43e7d906eff0f9c219e0402ecaa 100644 (file)
@@ -1498,7 +1498,8 @@ typedef enum {
        SFF_WAIT_KEY_FRAME = (1 << 12),
        SFF_RAW_RTP_PARSE_FRAME = (1 << 13),
        SFF_PICTURE_RESET = (1 << 14),
-       SFF_SAME_IMAGE = (1 << 15)
+       SFF_SAME_IMAGE = (1 << 15),
+       SFF_USE_VIDEO_TIMESTAMP = (1 << 16)
 } switch_frame_flag_enum_t;
 typedef uint32_t switch_frame_flag_t;
 
index b561eb246658fc23676313e059d5893a9ada0f08..7d2deb8f3dea4f02a66925c0d399e5d5cfa80dd6 100644 (file)
@@ -553,7 +553,9 @@ end:
                switch_set_flag(frame, SFF_WAIT_KEY_FRAME);
        }
 
-       if (!frame->img) {
+       if (frame->img) {
+               switch_set_flag(frame, SFF_USE_VIDEO_TIMESTAMP);
+       } else {
                status = SWITCH_STATUS_MORE_DATA;
        }
 
index 7806ecfe46433d91849565875e834813ab7ea799..ee7f7f63f7d6f1c3f4580a9606f1619725b09a6e 100644 (file)
@@ -553,7 +553,9 @@ end:
                switch_buffer_zero(context->vpx_packet_buffer);
        }
 
-       if (!frame->img) {
+       if (frame->img) {
+               switch_set_flag(frame, SFF_USE_VIDEO_TIMESTAMP);
+       } else {
                status = SWITCH_STATUS_MORE_DATA;
        }
 
index 2df5d3b5ec285d45b1bd90d6620d7cdefe299d6a..0a3866f58061ae1852f467a8c308fc9a3e395011 100644 (file)
@@ -4597,8 +4597,6 @@ SWITCH_DECLARE(void) switch_core_media_end_video_function(switch_core_session_t
        }
 }
 
-
->>>>>>> another refactoring pass, temp code still in place, WORK IN PROGRESS
 //?
 #define RA_PTR_LEN 512
 SWITCH_DECLARE(switch_status_t) switch_core_media_proxy_remote_addr(switch_core_session_t *session, const char *sdp_str)
@@ -9589,17 +9587,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
                return raw_write_video(session, frame, flags, stream_id);
        }
 
-       if (!(timer = switch_core_media_get_timer(session, SWITCH_MEDIA_TYPE_VIDEO))) {
+       if (!switch_test_flag(frame, SFF_USE_VIDEO_TIMESTAMP)) {
 
-               if (!smh->video_timer.timer_interface) {
-                       switch_core_timer_init(&smh->video_timer, "soft", 1, 90, switch_core_session_get_pool(session));
+               if (!(timer = switch_core_media_get_timer(session, SWITCH_MEDIA_TYPE_VIDEO))) {
+                       
+                       if (!smh->video_timer.timer_interface) {
+                               switch_core_timer_init(&smh->video_timer, "soft", 1, 90, switch_core_session_get_pool(session));
+                       }
+                       
+                       timer = &smh->video_timer;
                }
 
-               timer = &smh->video_timer;
+               frame->timestamp = timer->samplecount;
        }
 
-       frame->timestamp = timer->samplecount;
-       frame->flags &= ~SFF_SAME_IMAGE;
+       switch_clear_flag(frame, SFF_SAME_IMAGE);
 
        do {
                frame->datalen = SWITCH_DEFAULT_VIDEO_SIZE;