Chromium Code Reviews| Index: media/filters/ffmpeg_demuxer.cc |
| =================================================================== |
| --- media/filters/ffmpeg_demuxer.cc (revision 23515) |
| +++ media/filters/ffmpeg_demuxer.cc (working copy) |
| @@ -11,25 +11,6 @@ |
| #include "media/filters/ffmpeg_demuxer.h" |
| #include "media/filters/ffmpeg_glue.h" |
| -namespace { |
| - |
| -// Helper function to deep copy an AVPacket's data, size and timestamps. |
| -// Returns NULL if a packet could not be cloned (i.e., out of memory). |
| -AVPacket* ClonePacket(AVPacket* packet) { |
| - scoped_ptr<AVPacket> clone(new AVPacket()); |
| - if (!clone.get() || av_new_packet(clone.get(), packet->size) < 0) { |
|
fbarchard
2009/08/18 22:34:16
removing this breaks the unittest
C:\chrome-svn\sr
|
| - return NULL; |
| - } |
| - DCHECK_EQ(clone->size, packet->size); |
| - clone->dts = packet->dts; |
| - clone->pts = packet->pts; |
| - clone->duration = packet->duration; |
| - memcpy(clone->data, packet->data, clone->size); |
| - return clone.release(); |
| -} |
| - |
| -} // namespace |
| - |
| namespace media { |
| // |
| @@ -495,17 +476,10 @@ |
| DCHECK(packet->stream_index < static_cast<int>(packet_streams_.size())); |
| FFmpegDemuxerStream* demuxer_stream = packet_streams_[packet->stream_index]; |
| if (demuxer_stream) { |
| - // Duplicate the entire packet to avoid aliasing. |
| - // Directly affects MP3, but do all formats to be safe. |
| - scoped_ptr<AVPacket> clone(ClonePacket(packet.get())); |
| - if (!clone.get()) { |
| - NOTREACHED(); |
| - return; |
| - } |
| - // Free FFmpeg-allocated memory and swap original packet into |clone| so |
| - // that it gets deleted as |clone| goes out of scope. |
| - av_free_packet(packet.get()); |
| - packet.swap(clone); |
| + // If a packets is returned by FFmpeg's av_parser_parse2() |
| + // the packet will reference an inner memory of FFmpeg |
| + // In this case, the packet's "destruct" member is NULL, it MUST be duplicated. |
|
fbarchard
2009/08/18 22:34:16
nit more than 80 columns... break comment into 2 l
ffmpeg
2009/08/19 01:05:25
OK, Let's focus on issue: 174027 which is the enha
|
| + av_dup_packet(packet.get()); |
| // Queue the packet with the appropriate stream. The stream takes |
| // ownership of the AVPacket. |