summaryrefslogtreecommitdiff
path: root/libavformat/flvenc.c
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2017-01-24 12:31:36 +0800
committerSteven Liu <lq@chinaffmpeg.org>2017-01-24 12:31:36 +0800
commit1bb192ef6c1771ee18d1c5ed31d7c0cac8a25ebb (patch)
tree36953969a0e504b3d81cbcf0cb8e8f2e466c611f /libavformat/flvenc.c
parent2f7cc21b61220d205e3c57384f354187417971fb (diff)
downloadffmpeg-1bb192ef6c1771ee18d1c5ed31d7c0cac8a25ebb.tar.gz
avformat/flvenc: refine the flvenc shift_data code
refine the flvenc shift_data move data option Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavformat/flvenc.c')
-rw-r--r--libavformat/flvenc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 5714321282..d7506c56fb 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -626,13 +626,15 @@ static int shift_data(AVFormatContext *s)
avio_seek(read_pb, flv->keyframes_info_offset, SEEK_SET);
pos = avio_tell(read_pb);
- /* shift data by chunk of at most keyframe *filepositions* and *times* size */
+#define READ_BLOCK do { \
read_size[read_buf_id] = avio_read(read_pb, read_buf[read_buf_id], metadata_size); \
- read_buf_id ^= 1;
- do {
+ read_buf_id ^= 1; \
+} while (0)
- read_size[read_buf_id] = avio_read(read_pb, read_buf[read_buf_id], metadata_size); \
- read_buf_id ^= 1;
+ /* shift data by chunk of at most keyframe *filepositions* and *times* size */
+ READ_BLOCK;
+ do {
+ READ_BLOCK;
n = read_size[read_buf_id];
if (n < 0)
break;