Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 160529: demux duplicate data the same way as mp3 does. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/filters/ffmpeg_demuxer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_demuxer.cc
===================================================================
--- media/filters/ffmpeg_demuxer.cc (revision 23308)
+++ media/filters/ffmpeg_demuxer.cc (working copy)
@@ -495,22 +495,17 @@
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 if we're dealing with MP3 due to an issue
- // where previously demuxed packets can become corrupted by simply demuxing
- // additional packets.
- //
- // TODO(scherkus): fix the MP3 packet copying hack.
- if (demuxer_stream->GetAVStream()->codec->codec_id == CODEC_ID_MP3) {
- 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);
+ // 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);
// Queue the packet with the appropriate stream. The stream takes
// ownership of the AVPacket.
« no previous file with comments | « no previous file | media/filters/ffmpeg_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698