OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |