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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 scoped_refptr<DecoderBuffer> buffer = | 183 scoped_refptr<DecoderBuffer> buffer = |
184 DecoderBuffer::CopyFrom(packet.data, packet.size); | 184 DecoderBuffer::CopyFrom(packet.data, packet.size); |
185 buffer->set_timestamp(ConvertFromTimeBase( | 185 buffer->set_timestamp(ConvertFromTimeBase( |
186 reader_->GetAVStreamForTesting()->time_base, packet.pts)); | 186 reader_->GetAVStreamForTesting()->time_base, packet.pts)); |
187 buffer->set_duration(ConvertFromTimeBase( | 187 buffer->set_duration(ConvertFromTimeBase( |
188 reader_->GetAVStreamForTesting()->time_base, packet.duration)); | 188 reader_->GetAVStreamForTesting()->time_base, packet.duration)); |
| 189 if (packet.flags & AV_PKT_FLAG_KEY) |
| 190 buffer->set_is_key_frame(true); |
189 | 191 |
190 // Don't set discard padding for Opus, it already has discard behavior set | 192 // Don't set discard padding for Opus, it already has discard behavior set |
191 // based on the codec delay in the AudioDecoderConfig. | 193 // based on the codec delay in the AudioDecoderConfig. |
192 if (GetParam().decoder_type == FFMPEG) | 194 if (GetParam().decoder_type == FFMPEG) |
193 SetDiscardPadding(&packet, buffer, GetParam().samples_per_second); | 195 SetDiscardPadding(&packet, buffer, GetParam().samples_per_second); |
194 | 196 |
195 // DecodeBuffer() shouldn't need the original packet since it uses the copy. | 197 // DecodeBuffer() shouldn't need the original packet since it uses the copy. |
196 av_free_packet(&packet); | 198 av_free_packet(&packet); |
197 DecodeBuffer(buffer); | 199 DecodeBuffer(buffer); |
198 } | 200 } |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 }; | 524 }; |
523 | 525 |
524 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest, | 526 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest, |
525 AudioDecoderTest, | 527 AudioDecoderTest, |
526 testing::ValuesIn(kFFmpegTests)); | 528 testing::ValuesIn(kFFmpegTests)); |
527 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest, | 529 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest, |
528 FFmpegAudioDecoderBehavioralTest, | 530 FFmpegAudioDecoderBehavioralTest, |
529 testing::ValuesIn(kFFmpegBehavioralTest)); | 531 testing::ValuesIn(kFFmpegBehavioralTest)); |
530 | 532 |
531 } // namespace media | 533 } // namespace media |
OLD | NEW |