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

Side by Side Diff: media/filters/audio_file_reader.cc

Issue 286953005: Roll FFmpeg for M37. (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Roll DEPS for ChromiumOS fixes. Created 6 years, 7 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 unified diff | Download patch
« no previous file with comments | « media/ffmpeg/ffmpeg_unittest.cc ('k') | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/audio_file_reader.h" 5 #include "media/filters/audio_file_reader.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 AVPacket packet; 124 AVPacket packet;
125 int current_frame = 0; 125 int current_frame = 0;
126 bool continue_decoding = true; 126 bool continue_decoding = true;
127 127
128 while (current_frame < audio_bus->frames() && continue_decoding && 128 while (current_frame < audio_bus->frames() && continue_decoding &&
129 ReadPacket(&packet)) { 129 ReadPacket(&packet)) {
130 // Make a shallow copy of packet so we can slide packet.data as frames are 130 // Make a shallow copy of packet so we can slide packet.data as frames are
131 // decoded from the packet; otherwise av_free_packet() will corrupt memory. 131 // decoded from the packet; otherwise av_free_packet() will corrupt memory.
132 AVPacket packet_temp = packet; 132 AVPacket packet_temp = packet;
133 do { 133 do {
134 avcodec_get_frame_defaults(av_frame.get()); 134 // Reset frame to default values.
135 av_frame_unref(av_frame.get());
136
135 int frame_decoded = 0; 137 int frame_decoded = 0;
136 int result = avcodec_decode_audio4( 138 int result = avcodec_decode_audio4(
137 codec_context_, av_frame.get(), &frame_decoded, &packet_temp); 139 codec_context_, av_frame.get(), &frame_decoded, &packet_temp);
138 140
139 if (result < 0) { 141 if (result < 0) {
140 DLOG(WARNING) 142 DLOG(WARNING)
141 << "AudioFileReader::Read() : error in avcodec_decode_audio4() -" 143 << "AudioFileReader::Read() : error in avcodec_decode_audio4() -"
142 << result; 144 << result;
143 break; 145 break;
144 } 146 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 if (output_packet->stream_index != stream_index_) { 251 if (output_packet->stream_index != stream_index_) {
250 av_free_packet(output_packet); 252 av_free_packet(output_packet);
251 continue; 253 continue;
252 } 254 }
253 return true; 255 return true;
254 } 256 }
255 return false; 257 return false;
256 } 258 }
257 259
258 } // namespace media 260 } // namespace media
OLDNEW
« no previous file with comments | « media/ffmpeg/ffmpeg_unittest.cc ('k') | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698