X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffserver.c;h=fd7d3cba1609d2404ed4f990020db7056ba8195d;hb=469398f8b7a8ebe43bd4d5149cdc2b96eac53b76;hp=3cb29e4726ec00f7b3cdfc596ef3e19061346919;hpb=8985e7c56130b42f6184b064b7141e365f59356b;p=ffmpeg diff --git a/ffserver.c b/ffserver.c index 3cb29e4726e..fd7d3cba160 100644 --- a/ffserver.c +++ b/ffserver.c @@ -504,8 +504,7 @@ static void start_multicast(void) random1 = av_lfg_get(&random_state); /* open the RTP connection */ - snprintf(session_id, sizeof(session_id), "%08x%08x", - random0, random1); + snprintf(session_id, sizeof(session_id), "%08x%08x", random0, random1); /* choose a port if none given */ if (stream->multicast_port == 0) { @@ -967,6 +966,10 @@ static int handle_connection(HTTPContext *c) /* close connection if trailer sent */ if (c->state == HTTPSTATE_SEND_DATA_TRAILER) return -1; + /* Check if it is a single jpeg frame 123 */ + if (c->stream->single_frame && c->data_count > c->cur_frame_bytes && c->cur_frame_bytes > 0) { + close_connection(c); + } break; case HTTPSTATE_RECEIVE_DATA: /* no need to read if no events */ @@ -1162,8 +1165,10 @@ static int modify_current_stream(HTTPContext *c, char *rates) break; } - if (c->switch_feed_streams[i] >= 0 && c->switch_feed_streams[i] != c->feed_streams[i]) + if (c->switch_feed_streams[i] >= 0 && + c->switch_feed_streams[i] != c->feed_streams[i]) { action_required = 1; + } } return action_required; @@ -1267,9 +1272,7 @@ static int validate_acl(FFServerStream *stream, HTTPContext *c) if (stream->dynamic_acl[0]) { acl = parse_dynamic_acl(stream, c); - ret = validate_acl_list(acl, c); - free_acl_list(acl); } @@ -2116,11 +2119,10 @@ static int64_t get_packet_send_clock(HTTPContext *c) frame_bytes = c->cur_frame_bytes; if (frame_bytes <= 0) return c->cur_pts; - else { - bytes_left = c->buffer_end - c->buffer_ptr; - bytes_sent = frame_bytes - bytes_left; - return c->cur_pts + (c->cur_frame_duration * bytes_sent) / frame_bytes; - } + + bytes_left = c->buffer_end - c->buffer_ptr; + bytes_sent = frame_bytes - bytes_left; + return c->cur_pts + (c->cur_frame_duration * bytes_sent) / frame_bytes; } @@ -2215,20 +2217,20 @@ static int http_prepare_data(HTTPContext *c) ffm file, so must wait for more data */ c->state = HTTPSTATE_WAIT_FEED; return 1; /* state changed */ - } else if (ret == AVERROR(EAGAIN)) { + } + if (ret == AVERROR(EAGAIN)) { /* input not ready, come back later */ return 0; + } + if (c->stream->loop) { + avformat_close_input(&c->fmt_in); + if (open_input_stream(c, "") < 0) + goto no_loop; + goto redo; } else { - if (c->stream->loop) { - avformat_close_input(&c->fmt_in); - if (open_input_stream(c, "") < 0) - goto no_loop; - goto redo; - } else { no_loop: /* must send trailer now because EOF or error */ c->state = HTTPSTATE_SEND_DATA_TRAILER; - } } } else { int source_index = pkt.stream_index;