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

Unified Diff: media/filters/audio_file_reader.cc

Issue 257563007: Don't double correct for discarded codec delay frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style cleanup. Fix rendundant Initialize(). Created 6 years, 8 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 | « media/filters/audio_file_reader.h ('k') | media/filters/opus_audio_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_file_reader.cc
diff --git a/media/filters/audio_file_reader.cc b/media/filters/audio_file_reader.cc
index 58dee72e5d91a8c34af83d6b024f42fe2348749e..80f8ce60a624e66d0016224d1e0b6cd88476f8d5 100644
--- a/media/filters/audio_file_reader.cc
+++ b/media/filters/audio_file_reader.cc
@@ -126,14 +126,7 @@ int AudioFileReader::Read(AudioBus* audio_bus) {
bool continue_decoding = true;
while (current_frame < audio_bus->frames() && continue_decoding &&
- av_read_frame(glue_->format_context(), &packet) >= 0 &&
- av_dup_packet(&packet) >= 0) {
- // Skip packets from other streams.
- if (packet.stream_index != stream_index_) {
- av_free_packet(&packet);
- continue;
- }
-
+ ReadPacket(&packet)) {
// Make a shallow copy of packet so we can slide packet.data as frames are
// decoded from the packet; otherwise av_free_packet() will corrupt memory.
AVPacket packet_temp = packet;
@@ -245,4 +238,21 @@ int AudioFileReader::GetNumberOfFrames() const {
return static_cast<int>(ceil(GetDuration().InSecondsF() * sample_rate()));
}
+bool AudioFileReader::ReadPacketForTesting(AVPacket* output_packet) {
+ return ReadPacket(output_packet);
+}
+
+bool AudioFileReader::ReadPacket(AVPacket* output_packet) {
+ while (av_read_frame(glue_->format_context(), output_packet) >= 0 &&
+ av_dup_packet(output_packet) >= 0) {
+ // Skip packets from other streams.
+ if (output_packet->stream_index != stream_index_) {
+ av_free_packet(output_packet);
+ continue;
+ }
+ return true;
+ }
+ return false;
+}
+
} // namespace media
« no previous file with comments | « media/filters/audio_file_reader.h ('k') | media/filters/opus_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698