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

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

Issue 712593003: Move key frame flag from StreamParserBuffer to DecoderBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <deque> 5 #include <deque>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/md5.h" 9 #include "base/md5.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 base::RunLoop().RunUntilIdle(); 173 base::RunLoop().RunUntilIdle();
174 } 174 }
175 175
176 void Decode() { 176 void Decode() {
177 AVPacket packet; 177 AVPacket packet;
178 ASSERT_TRUE(reader_->ReadPacketForTesting(&packet)); 178 ASSERT_TRUE(reader_->ReadPacketForTesting(&packet));
179 179
180 // Split out packet metadata before making a copy. 180 // Split out packet metadata before making a copy.
181 av_packet_split_side_data(&packet); 181 av_packet_split_side_data(&packet);
182 182
183 bool is_keyframe = packet.flags & AV_PKT_FLAG_KEY;
183 scoped_refptr<DecoderBuffer> buffer = 184 scoped_refptr<DecoderBuffer> buffer =
184 DecoderBuffer::CopyFrom(packet.data, packet.size); 185 DecoderBuffer::CopyFrom(packet.data, packet.size, is_keyframe);
185 buffer->set_timestamp(ConvertFromTimeBase( 186 buffer->set_timestamp(ConvertFromTimeBase(
186 reader_->GetAVStreamForTesting()->time_base, packet.pts)); 187 reader_->GetAVStreamForTesting()->time_base, packet.pts));
187 buffer->set_duration(ConvertFromTimeBase( 188 buffer->set_duration(ConvertFromTimeBase(
188 reader_->GetAVStreamForTesting()->time_base, packet.duration)); 189 reader_->GetAVStreamForTesting()->time_base, packet.duration));
189 190
190 // Don't set discard padding for Opus, it already has discard behavior set 191 // Don't set discard padding for Opus, it already has discard behavior set
191 // based on the codec delay in the AudioDecoderConfig. 192 // based on the codec delay in the AudioDecoderConfig.
192 if (GetParam().decoder_type == FFMPEG) 193 if (GetParam().decoder_type == FFMPEG)
193 SetDiscardPadding(&packet, buffer, GetParam().samples_per_second); 194 SetDiscardPadding(&packet, buffer, GetParam().samples_per_second);
194 195
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 }; 523 };
523 524
524 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest, 525 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest,
525 AudioDecoderTest, 526 AudioDecoderTest,
526 testing::ValuesIn(kFFmpegTests)); 527 testing::ValuesIn(kFFmpegTests));
527 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest, 528 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest,
528 FFmpegAudioDecoderBehavioralTest, 529 FFmpegAudioDecoderBehavioralTest,
529 testing::ValuesIn(kFFmpegBehavioralTest)); 530 testing::ValuesIn(kFFmpegBehavioralTest));
530 531
531 } // namespace media 532 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698