Merge remote-tracking branch 'qatar/master'
* qatar/master: Avoid C99 variable declarations within for statements. rtmp: Read and handle incoming packets while writing data doc: document THREAD_TYPE fate variable rtpdec: Don't require frames to start with a Mode A packet avconv: don't try to free threads that were not initialized. Conflicts: doc/fate.texi ffplay.c libavdevice/dv1394.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
15f8941108
@ -169,6 +169,9 @@ the synchronisation of the samples directory.
|
|||||||
@item THREADS
|
@item THREADS
|
||||||
Specify how many threads to use while running regression tests, it is
|
Specify how many threads to use while running regression tests, it is
|
||||||
quite useful to detect thread-related regressions.
|
quite useful to detect thread-related regressions.
|
||||||
|
@item THREAD_TYPE
|
||||||
|
Specify which threading strategy test, either @var{slice} or @var{frame},
|
||||||
|
by default @var{slice+frame}
|
||||||
@item CPUFLAGS
|
@item CPUFLAGS
|
||||||
Specify CPU flags.
|
Specify CPU flags.
|
||||||
@item TARGET_EXEC
|
@item TARGET_EXEC
|
||||||
|
2
ffmpeg.c
2
ffmpeg.c
@ -3372,7 +3372,7 @@ static void free_input_threads(void)
|
|||||||
InputFile *f = input_files[i];
|
InputFile *f = input_files[i];
|
||||||
AVPacket pkt;
|
AVPacket pkt;
|
||||||
|
|
||||||
if (f->joined)
|
if (!f->fifo || f->joined)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pthread_mutex_lock(&f->fifo_lock);
|
pthread_mutex_lock(&f->fifo_lock);
|
||||||
|
7
ffplay.c
7
ffplay.c
@ -2687,14 +2687,13 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
|
|||||||
|
|
||||||
static void toggle_full_screen(VideoState *is)
|
static void toggle_full_screen(VideoState *is)
|
||||||
{
|
{
|
||||||
av_unused int i;
|
|
||||||
is_full_screen = !is_full_screen;
|
|
||||||
#if defined(__APPLE__) && SDL_VERSION_ATLEAST(1, 2, 14)
|
#if defined(__APPLE__) && SDL_VERSION_ATLEAST(1, 2, 14)
|
||||||
/* OS X needs to reallocate the SDL overlays */
|
/* OS X needs to reallocate the SDL overlays */
|
||||||
for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) {
|
int i;
|
||||||
|
for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++)
|
||||||
is->pictq[i].reallocate = 1;
|
is->pictq[i].reallocate = 1;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
is_full_screen = !is_full_screen;
|
||||||
video_open(is, 1);
|
video_open(is, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -886,8 +886,8 @@ error:
|
|||||||
|
|
||||||
void ff_thread_flush(AVCodecContext *avctx)
|
void ff_thread_flush(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
FrameThreadContext *fctx = avctx->thread_opaque;
|
|
||||||
int i;
|
int i;
|
||||||
|
FrameThreadContext *fctx = avctx->thread_opaque;
|
||||||
|
|
||||||
if (!avctx->thread_opaque) return;
|
if (!avctx->thread_opaque) return;
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@
|
|||||||
reset_dv1394();
|
reset_dv1394();
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < status.n_clear_frames; i++) {
|
for (i = 0; i < status.n_clear_frames; i++) {
|
||||||
copy_DV_frame();
|
copy_DV_frame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,15 +74,25 @@ void ff_amf_write_object_end(uint8_t **dst)
|
|||||||
int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
|
int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
|
||||||
int chunk_size, RTMPPacket *prev_pkt)
|
int chunk_size, RTMPPacket *prev_pkt)
|
||||||
{
|
{
|
||||||
uint8_t hdr, t, buf[16];
|
uint8_t hdr;
|
||||||
|
|
||||||
|
if (ffurl_read(h, &hdr, 1) != 1)
|
||||||
|
return AVERROR(EIO);
|
||||||
|
|
||||||
|
return ff_rtmp_packet_read_internal(h, p, chunk_size, prev_pkt, hdr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ff_rtmp_packet_read_internal(URLContext *h, RTMPPacket *p, int chunk_size,
|
||||||
|
RTMPPacket *prev_pkt, uint8_t hdr)
|
||||||
|
{
|
||||||
|
|
||||||
|
uint8_t t, buf[16];
|
||||||
int channel_id, timestamp, data_size, offset = 0;
|
int channel_id, timestamp, data_size, offset = 0;
|
||||||
uint32_t extra = 0;
|
uint32_t extra = 0;
|
||||||
enum RTMPPacketType type;
|
enum RTMPPacketType type;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (ffurl_read(h, &hdr, 1) != 1)
|
|
||||||
return AVERROR(EIO);
|
|
||||||
size++;
|
size++;
|
||||||
channel_id = hdr & 0x3F;
|
channel_id = hdr & 0x3F;
|
||||||
|
|
||||||
|
@ -115,6 +115,19 @@ void ff_rtmp_packet_destroy(RTMPPacket *pkt);
|
|||||||
*/
|
*/
|
||||||
int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
|
int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
|
||||||
int chunk_size, RTMPPacket *prev_pkt);
|
int chunk_size, RTMPPacket *prev_pkt);
|
||||||
|
/**
|
||||||
|
* Read internal RTMP packet sent by the server.
|
||||||
|
*
|
||||||
|
* @param h reader context
|
||||||
|
* @param p packet
|
||||||
|
* @param chunk_size current chunk size
|
||||||
|
* @param prev_pkt previously read packet headers for all channels
|
||||||
|
* (may be needed for restoring incomplete packet header)
|
||||||
|
* @param c the first byte already read
|
||||||
|
* @return number of bytes read on success, negative value otherwise
|
||||||
|
*/
|
||||||
|
int ff_rtmp_packet_read_internal(URLContext *h, RTMPPacket *p, int chunk_size,
|
||||||
|
RTMPPacket *prev_pkt, uint8_t c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send RTMP packet to the server.
|
* Send RTMP packet to the server.
|
||||||
|
@ -1287,6 +1287,7 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
|
|||||||
int pktsize, pkttype;
|
int pktsize, pkttype;
|
||||||
uint32_t ts;
|
uint32_t ts;
|
||||||
const uint8_t *buf_temp = buf;
|
const uint8_t *buf_temp = buf;
|
||||||
|
uint8_t c;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@ -1356,6 +1357,35 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
|
|||||||
rt->flv_header_bytes = 0;
|
rt->flv_header_bytes = 0;
|
||||||
}
|
}
|
||||||
} while (buf_temp - buf < size);
|
} while (buf_temp - buf < size);
|
||||||
|
|
||||||
|
/* set stream into nonblocking mode */
|
||||||
|
rt->stream->flags |= AVIO_FLAG_NONBLOCK;
|
||||||
|
|
||||||
|
/* try to read one byte from the stream */
|
||||||
|
ret = ffurl_read(rt->stream, &c, 1);
|
||||||
|
|
||||||
|
/* switch the stream back into blocking mode */
|
||||||
|
rt->stream->flags &= ~AVIO_FLAG_NONBLOCK;
|
||||||
|
|
||||||
|
if (ret == AVERROR(EAGAIN)) {
|
||||||
|
/* no incoming data to handle */
|
||||||
|
return size;
|
||||||
|
} else if (ret < 0) {
|
||||||
|
return ret;
|
||||||
|
} else if (ret == 1) {
|
||||||
|
RTMPPacket rpkt = { 0 };
|
||||||
|
|
||||||
|
if ((ret = ff_rtmp_packet_read_internal(rt->stream, &rpkt,
|
||||||
|
rt->chunk_size,
|
||||||
|
rt->prev_pkt[0], c)) <= 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if ((ret = rtmp_parse_result(s, rt, &rpkt)) < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ff_rtmp_packet_destroy(&rpkt);
|
||||||
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
|||||||
if (!data->buf) {
|
if (!data->buf) {
|
||||||
/* Check the picture start code, only start buffering a new frame
|
/* Check the picture start code, only start buffering a new frame
|
||||||
* if this is correct */
|
* if this is correct */
|
||||||
if (!f && len > 4 && AV_RB32(buf) >> 10 == 0x20) {
|
if (len > 4 && AV_RB32(buf) >> 10 == 0x20) {
|
||||||
int ret = avio_open_dyn_buf(&data->buf);
|
int ret = avio_open_dyn_buf(&data->buf);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user