Mercurial > libavcodec.hg
comparison libvorbis.c @ 11907:defe337cf643 libavcodec
libvorbis: Only drop 1-byte packets at end of stream
This fixes handling of totally silent packets during the encoding, that
also are 1 byte in size.
This fixes issue 2013
author | mstorsjo |
---|---|
date | Tue, 22 Jun 2010 06:53:06 +0000 |
parents | 6a09fc06317a |
children | 032a8dc03ced |
comparison
equal
deleted
inserted
replaced
11906:a1b4029b2465 | 11907:defe337cf643 |
---|---|
169 vorbis_bitrate_addblock(&context->vb) ; | 169 vorbis_bitrate_addblock(&context->vb) ; |
170 | 170 |
171 while(vorbis_bitrate_flushpacket(&context->vd, &op)) { | 171 while(vorbis_bitrate_flushpacket(&context->vd, &op)) { |
172 /* i'd love to say the following line is a hack, but sadly it's | 172 /* i'd love to say the following line is a hack, but sadly it's |
173 * not, apparently the end of stream decision is in libogg. */ | 173 * not, apparently the end of stream decision is in libogg. */ |
174 if(op.bytes==1) | 174 if(op.bytes==1 && op.e_o_s) |
175 continue; | 175 continue; |
176 memcpy(context->buffer + context->buffer_index, &op, sizeof(ogg_packet)); | 176 memcpy(context->buffer + context->buffer_index, &op, sizeof(ogg_packet)); |
177 context->buffer_index += sizeof(ogg_packet); | 177 context->buffer_index += sizeof(ogg_packet); |
178 memcpy(context->buffer + context->buffer_index, op.packet, op.bytes); | 178 memcpy(context->buffer + context->buffer_index, op.packet, op.bytes); |
179 context->buffer_index += op.bytes; | 179 context->buffer_index += op.bytes; |