Browse Source

rtmp-stream: Change TEST_FRAMEDROPS to just sleep

Instead of making the send buffer size super small, just do a sleep when
sending data to simulate the inability to send out as much data as
desired.
jp9000 11 years ago
parent
commit
be2b0d1398
1 changed files with 3 additions and 4 deletions
  1. 3 4
      plugins/obs-outputs/rtmp-stream.c

+ 3 - 4
plugins/obs-outputs/rtmp-stream.c

@@ -193,6 +193,9 @@ static int send_packet(struct rtmp_stream *stream,
 	int     ret = 0;
 
 	flv_packet_mux(packet, &data, &size, is_header);
+#ifdef TEST_FRAMEDROPS
+	os_sleep_ms(rand() % 40);
+#endif
 	ret = RTMP_Write(&stream->rtmp, (char*)data, (int)size);
 	bfree(data);
 
@@ -316,15 +319,11 @@ static void adjust_sndbuf_size(struct rtmp_stream *stream, int new_size)
 	int cur_sendbuf_size = new_size;
 	socklen_t int_size = sizeof(int);
 
-#ifndef TEST_FRAMEDROPS
 	getsockopt(stream->rtmp.m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF,
 			(char*)&cur_sendbuf_size, &int_size);
 
 	if (cur_sendbuf_size < new_size) {
 		cur_sendbuf_size = new_size;
-#else
-		{cur_sendbuf_size = 1024*8;
-#endif
 		setsockopt(stream->rtmp.m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF,
 				(const char*)&cur_sendbuf_size, int_size);
 	}