ffserver: extend feedback in http_start_receive_data()
This commit is contained in:
parent
d2e46b11e4
commit
0124fca03f
35
ffserver.c
35
ffserver.c
@ -2622,19 +2622,26 @@ static int http_send_data(HTTPContext *c)
|
|||||||
static int http_start_receive_data(HTTPContext *c)
|
static int http_start_receive_data(HTTPContext *c)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (c->stream->feed_opened)
|
if (c->stream->feed_opened) {
|
||||||
return -1;
|
http_log("Stream feed '%s' was not opened\n", c->stream->feed_filename);
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
/* Don't permit writing to this one */
|
/* Don't permit writing to this one */
|
||||||
if (c->stream->readonly)
|
if (c->stream->readonly) {
|
||||||
return -1;
|
http_log("Cannot write to read-only file '%s'\n", c->stream->feed_filename);
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
/* open feed */
|
/* open feed */
|
||||||
fd = open(c->stream->feed_filename, O_RDWR);
|
fd = open(c->stream->feed_filename, O_RDWR);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
http_log("Error opening feeder file: %s\n", strerror(errno));
|
ret = AVERROR(errno);
|
||||||
return -1;
|
http_log("Could not open feed file '%s':%s \n",
|
||||||
|
c->stream->feed_filename, strerror(errno));
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
c->feed_fd = fd;
|
c->feed_fd = fd;
|
||||||
|
|
||||||
@ -2643,13 +2650,19 @@ static int http_start_receive_data(HTTPContext *c)
|
|||||||
ffm_write_write_index(c->feed_fd, FFM_PACKET_SIZE);
|
ffm_write_write_index(c->feed_fd, FFM_PACKET_SIZE);
|
||||||
http_log("Truncating feed file '%s'\n", c->stream->feed_filename);
|
http_log("Truncating feed file '%s'\n", c->stream->feed_filename);
|
||||||
if (ftruncate(c->feed_fd, FFM_PACKET_SIZE) < 0) {
|
if (ftruncate(c->feed_fd, FFM_PACKET_SIZE) < 0) {
|
||||||
http_log("Error truncating feed file: %s\n", strerror(errno));
|
ret = AVERROR(errno);
|
||||||
return -1;
|
http_log("Error truncating feed file '%s': %s\n",
|
||||||
|
c->stream->feed_filename, strerror(errno));
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((c->stream->feed_write_index = ffm_read_write_index(fd)) < 0) {
|
ret = ffm_read_write_index(fd);
|
||||||
http_log("Error reading write index from feed file: %s\n", strerror(errno));
|
if (ret < 0) {
|
||||||
return -1;
|
http_log("Error reading write index from feed file '%s': %s\n",
|
||||||
|
c->stream->feed_filename, strerror(errno));
|
||||||
|
return ret;
|
||||||
|
} else {
|
||||||
|
c->stream->feed_write_index = ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user