You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	avformat/movenc: always check for new extradata on a packet
Don't just look at zero sized packets, and also check for AAC extradata updates, in preparation for the following patches. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
		| @@ -5313,16 +5313,8 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) | |||||||
|             mov->flags &= ~FF_MOV_FLAG_FRAG_DISCONT; |             mov->flags &= ~FF_MOV_FLAG_FRAG_DISCONT; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (!pkt->size) { |  | ||||||
|             if (trk->start_dts == AV_NOPTS_VALUE && trk->frag_discont) { |  | ||||||
|                 trk->start_dts = pkt->dts; |  | ||||||
|                 if (pkt->pts != AV_NOPTS_VALUE) |  | ||||||
|                     trk->start_cts = pkt->pts - pkt->dts; |  | ||||||
|                 else |  | ||||||
|                     trk->start_cts = 0; |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|         if (trk->par->codec_id == AV_CODEC_ID_MP4ALS || |         if (trk->par->codec_id == AV_CODEC_ID_MP4ALS || | ||||||
|  |             trk->par->codec_id == AV_CODEC_ID_AAC || | ||||||
|             trk->par->codec_id == AV_CODEC_ID_FLAC) { |             trk->par->codec_id == AV_CODEC_ID_FLAC) { | ||||||
|             int side_size = 0; |             int side_size = 0; | ||||||
|             uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); |             uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); | ||||||
| @@ -5334,10 +5326,20 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) | |||||||
|                 par->extradata = newextra; |                 par->extradata = newextra; | ||||||
|                 memcpy(par->extradata, side, side_size); |                 memcpy(par->extradata, side, side_size); | ||||||
|                 par->extradata_size = side_size; |                 par->extradata_size = side_size; | ||||||
|  |                 if (!pkt->size) // Flush packet | ||||||
|                     mov->need_rewrite_extradata = 1; |                     mov->need_rewrite_extradata = 1; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         if (!pkt->size) { | ||||||
|  |             if (trk->start_dts == AV_NOPTS_VALUE && trk->frag_discont) { | ||||||
|  |                 trk->start_dts = pkt->dts; | ||||||
|  |                 if (pkt->pts != AV_NOPTS_VALUE) | ||||||
|  |                     trk->start_cts = pkt->pts - pkt->dts; | ||||||
|  |                 else | ||||||
|  |                     trk->start_cts = 0; | ||||||
|  |             } | ||||||
|  |  | ||||||
|             return 0;             /* Discard 0 sized packets */ |             return 0;             /* Discard 0 sized packets */ | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user