OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 API_REGISTER_STATE_CHECK( | 62 API_REGISTER_STATE_CHECK( |
63 res = vpx_codec_encode(&encoder_, | 63 res = vpx_codec_encode(&encoder_, |
64 video.img(), video.pts(), video.duration(), | 64 video.img(), video.pts(), video.duration(), |
65 frame_flags, deadline_)); | 65 frame_flags, deadline_)); |
66 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); | 66 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); |
67 } | 67 } |
68 | 68 |
69 void Encoder::Flush() { | 69 void Encoder::Flush() { |
70 const vpx_codec_err_t res = vpx_codec_encode(&encoder_, NULL, 0, 0, 0, | 70 const vpx_codec_err_t res = vpx_codec_encode(&encoder_, NULL, 0, 0, 0, |
71 deadline_); | 71 deadline_); |
72 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); | 72 if (!encoder_.priv) |
| 73 ASSERT_EQ(VPX_CODEC_ERROR, res) << EncoderError(); |
| 74 else |
| 75 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); |
73 } | 76 } |
74 | 77 |
75 void EncoderTest::InitializeConfig() { | 78 void EncoderTest::InitializeConfig() { |
76 const vpx_codec_err_t res = codec_->DefaultEncoderConfig(&cfg_, 0); | 79 const vpx_codec_err_t res = codec_->DefaultEncoderConfig(&cfg_, 0); |
77 ASSERT_EQ(VPX_CODEC_OK, res); | 80 ASSERT_EQ(VPX_CODEC_OK, res); |
78 } | 81 } |
79 | 82 |
80 void EncoderTest::SetMode(TestMode mode) { | 83 void EncoderTest::SetMode(TestMode mode) { |
81 switch (mode) { | 84 switch (mode) { |
82 case kRealTime: | 85 case kRealTime: |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 bool has_dxdata = false; | 173 bool has_dxdata = false; |
171 while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) { | 174 while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) { |
172 pkt = MutateEncoderOutputHook(pkt); | 175 pkt = MutateEncoderOutputHook(pkt); |
173 again = true; | 176 again = true; |
174 switch (pkt->kind) { | 177 switch (pkt->kind) { |
175 case VPX_CODEC_CX_FRAME_PKT: | 178 case VPX_CODEC_CX_FRAME_PKT: |
176 has_cxdata = true; | 179 has_cxdata = true; |
177 if (decoder && DoDecode()) { | 180 if (decoder && DoDecode()) { |
178 vpx_codec_err_t res_dec = decoder->DecodeFrame( | 181 vpx_codec_err_t res_dec = decoder->DecodeFrame( |
179 (const uint8_t*)pkt->data.frame.buf, pkt->data.frame.sz); | 182 (const uint8_t*)pkt->data.frame.buf, pkt->data.frame.sz); |
180 ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError(); | 183 |
| 184 if (!HandleDecodeResult(res_dec, *video, decoder)) |
| 185 break; |
| 186 |
181 has_dxdata = true; | 187 has_dxdata = true; |
182 } | 188 } |
183 ASSERT_GE(pkt->data.frame.pts, last_pts_); | 189 ASSERT_GE(pkt->data.frame.pts, last_pts_); |
184 last_pts_ = pkt->data.frame.pts; | 190 last_pts_ = pkt->data.frame.pts; |
185 FramePktHook(pkt); | 191 FramePktHook(pkt); |
186 break; | 192 break; |
187 | 193 |
188 case VPX_CODEC_PSNR_PKT: | 194 case VPX_CODEC_PSNR_PKT: |
189 PSNRPktHook(pkt); | 195 PSNRPktHook(pkt); |
190 break; | 196 break; |
(...skipping 25 matching lines...) Expand all Loading... |
216 if (decoder) | 222 if (decoder) |
217 delete decoder; | 223 delete decoder; |
218 delete encoder; | 224 delete encoder; |
219 | 225 |
220 if (!Continue()) | 226 if (!Continue()) |
221 break; | 227 break; |
222 } | 228 } |
223 } | 229 } |
224 | 230 |
225 } // namespace libvpx_test | 231 } // namespace libvpx_test |
OLD | NEW |