Skip to content

Instantly share code, notes, and snippets.

@seven1240
Created November 19, 2014 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seven1240/8f7d60f4f2ba1bc427dd to your computer and use it in GitHub Desktop.
Save seven1240/8f7d60f4f2ba1bc427dd to your computer and use it in GitHub Desktop.
diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c
index 8ba521d..e681768 100644
--- a/src/switch_core_codec.c
+++ b/src/switch_core_codec.c
@@ -812,9 +812,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_encode_video(switch_codec_t *c
if (frame->datalen) {
frame->packetlen = frame->datalen + 12;
- frame->flags |= SFF_SAME_IMAGE;
+ // frame->flags |= SFF_SAME_IMAGE;
} else {
- frame->flags &= ~SFF_SAME_IMAGE;
+ // frame->flags &= ~SFF_SAME_IMAGE;
}
}
diff --git a/src/switch_core_media.c b/src/switch_core_media.c
index 0549ef5..b5931c8 100644
--- a/src/switch_core_media.c
+++ b/src/switch_core_media.c
@@ -9423,6 +9423,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
int stream_id)
{
switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_status_t encode_status;
switch_time_t now = switch_micro_time_now();
switch_codec_t *codec = switch_core_session_get_video_write_codec(session);
switch_timer_t *timer;
@@ -9480,7 +9481,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
do {
frame->datalen = SWITCH_DEFAULT_VIDEO_SIZE;
- switch_core_codec_encode_video(codec, frame);
+ encode_status = switch_core_codec_encode_video(codec, frame);
if (frame->flags & SFF_PICTURE_RESET) {
smh->video_init = 0;
@@ -9488,15 +9489,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
frame->flags &= ~SFF_PICTURE_RESET;
}
+ if (encode_status != SWITCH_STATUS_SUCCESS && encode_status != SWITCH_STATUS_MORE_DATA) break;
+
switch_set_flag(frame, SFF_RAW_RTP_PARSE_FRAME);
-
+
status = raw_write_video(session, frame, flags, stream_id);
if (status == SWITCH_STATUS_SUCCESS && session->image_write_callback) {
session->image_write_callback(session, frame, img, session->image_write_callback_user_data);
}
- } while(frame->datalen);
+ switch_set_flag(frame, SFF_SAME_IMAGE);
+
+ } while(encode_status == SWITCH_STATUS_MORE_DATA);
return status;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment