[FFmpeg-trac] #8762(avcodec:new): dv remux loses sync
FFmpeg
trac at avcodec.org
Mon Jun 29 01:41:03 EEST 2020
#8762: dv remux loses sync
------------------------------------+-----------------------------------
Reporter: dericed | Owner:
Type: defect | Status: new
Priority: normal | Component: avcodec
Version: git-master | Resolution:
Keywords: dvvideo | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
------------------------------------+-----------------------------------
Changes (by cehoyos):
* version: unspecified => git-master
Comment:
Does the following help?
{{{
diff --git a/libavcodec/dv.h b/libavcodec/dv.h
index 0205d72347..fd509e9377 100644
--- a/libavcodec/dv.h
+++ b/libavcodec/dv.h
@@ -36,6 +36,7 @@
typedef struct DVwork_chunk {
uint16_t buf_offset;
uint16_t mb_coordinates[5];
+ int got_frame;
} DVwork_chunk;
typedef struct DVVideoContext {
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index c526091eb4..3fc738c702 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -339,6 +339,7 @@ static int dv_decode_video_segment(AVCodecContext
*avctx, void *arg)
av_assert1((((int) mb_bit_buffer) & 7) == 0);
av_assert1((((int) vs_bit_buffer) & 7) == 0);
+ work_chunk->got_frame = 1;
retry:
memset(sblock, 0, 5 * DV_MAX_BPM * sizeof(*sblock));
@@ -356,6 +357,10 @@ retry:
vs_bit_buffer_damaged = 1;
if (!mb_index) {
sta = buf_ptr[3] >> 4;
+ if (sta == 0xa) {
+ work_chunk->got_frame = 0;
+ return -1;
+ }
} else if (sta != (buf_ptr[3] >> 4))
vs_bit_buffer_damaged = 1;
}
@@ -613,7 +618,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
void *data,
emms_c();
/* return image */
- *got_frame = 1;
+ *got_frame = s->work_chunks->got_frame;
return s->sys->frame_size;
}
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/8762#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list