OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 int picture_id_; | 112 int picture_id_; |
113 int temporal_layer_[kNumberOfSimulcastStreams]; | 113 int temporal_layer_[kNumberOfSimulcastStreams]; |
114 bool layer_sync_[kNumberOfSimulcastStreams]; | 114 bool layer_sync_[kNumberOfSimulcastStreams]; |
115 }; | 115 }; |
116 | 116 |
117 class Vp8TestDecodedImageCallback : public DecodedImageCallback { | 117 class Vp8TestDecodedImageCallback : public DecodedImageCallback { |
118 public: | 118 public: |
119 Vp8TestDecodedImageCallback() : decoded_frames_(0) {} | 119 Vp8TestDecodedImageCallback() : decoded_frames_(0) {} |
120 int32_t Decoded(VideoFrame& decoded_image) override { | 120 int32_t Decoded(VideoFrame& decoded_image) override { |
121 for (int i = 0; i < decoded_image.width(); ++i) { | 121 for (int i = 0; i < decoded_image.width(); ++i) { |
122 EXPECT_NEAR(kColorY, decoded_image.video_frame_buffer()->DataY()[i], 1); | 122 EXPECT_NEAR(kColorY, decoded_image.buffer(kYPlane)[i], 1); |
123 } | 123 } |
124 | 124 |
125 // TODO(mikhal): Verify the difference between U,V and the original. | 125 // TODO(mikhal): Verify the difference between U,V and the original. |
126 for (int i = 0; i < ((decoded_image.width() + 1) / 2); ++i) { | 126 for (int i = 0; i < ((decoded_image.width() + 1) / 2); ++i) { |
127 EXPECT_NEAR(kColorU, decoded_image.video_frame_buffer()->DataU()[i], 4); | 127 EXPECT_NEAR(kColorU, decoded_image.buffer(kUPlane)[i], 4); |
128 EXPECT_NEAR(kColorV, decoded_image.video_frame_buffer()->DataV()[i], 4); | 128 EXPECT_NEAR(kColorV, decoded_image.buffer(kVPlane)[i], 4); |
129 } | 129 } |
130 decoded_frames_++; | 130 decoded_frames_++; |
131 return 0; | 131 return 0; |
132 } | 132 } |
133 int32_t Decoded(VideoFrame& decoded_image, int64_t decode_time_ms) override { | 133 int32_t Decoded(VideoFrame& decoded_image, int64_t decode_time_ms) override { |
134 RTC_NOTREACHED(); | 134 RTC_NOTREACHED(); |
135 return -1; | 135 return -1; |
136 } | 136 } |
137 int DecodedFrames() { return decoded_frames_; } | 137 int DecodedFrames() { return decoded_frames_; } |
138 | 138 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 mutable std::vector<TemporalLayers*> spying_layers_; | 216 mutable std::vector<TemporalLayers*> spying_layers_; |
217 }; | 217 }; |
218 }; | 218 }; |
219 | 219 |
220 class TestVp8Simulcast : public ::testing::Test { | 220 class TestVp8Simulcast : public ::testing::Test { |
221 public: | 221 public: |
222 TestVp8Simulcast(VP8Encoder* encoder, VP8Decoder* decoder) | 222 TestVp8Simulcast(VP8Encoder* encoder, VP8Decoder* decoder) |
223 : encoder_(encoder), decoder_(decoder) {} | 223 : encoder_(encoder), decoder_(decoder) {} |
224 | 224 |
225 static void SetPlane(uint8_t* data, | 225 // Creates an VideoFrame from |plane_colors|. |
226 uint8_t value, | 226 static void CreateImage(VideoFrame* frame, int plane_colors[kNumOfPlanes]) { |
227 int width, | 227 for (int plane_num = 0; plane_num < kNumOfPlanes; ++plane_num) { |
228 int height, | 228 int width = |
229 int stride) { | 229 (plane_num != kYPlane ? (frame->width() + 1) / 2 : frame->width()); |
230 for (int i = 0; i < height; i++, data += stride) { | 230 int height = |
| 231 (plane_num != kYPlane ? (frame->height() + 1) / 2 : frame->height()); |
| 232 PlaneType plane_type = static_cast<PlaneType>(plane_num); |
| 233 uint8_t* data = frame->buffer(plane_type); |
231 // Setting allocated area to zero - setting only image size to | 234 // Setting allocated area to zero - setting only image size to |
232 // requested values - will make it easier to distinguish between image | 235 // requested values - will make it easier to distinguish between image |
233 // size and frame size (accounting for stride). | 236 // size and frame size (accounting for stride). |
234 memset(data, value, width); | 237 memset(frame->buffer(plane_type), 0, frame->allocated_size(plane_type)); |
235 memset(data + width, 0, stride - width); | 238 for (int i = 0; i < height; i++) { |
| 239 memset(data, plane_colors[plane_num], width); |
| 240 data += frame->stride(plane_type); |
| 241 } |
236 } | 242 } |
237 } | 243 } |
238 | 244 |
239 // Fills in an VideoFrameBuffer from |plane_colors|. | |
240 static void CreateImage(const rtc::scoped_refptr<VideoFrameBuffer>& buffer, | |
241 int plane_colors[kNumOfPlanes]) { | |
242 int width = buffer->width(); | |
243 int height = buffer->height(); | |
244 int chroma_width = (width + 1) / 2; | |
245 int chroma_height = (height + 1) / 2; | |
246 | |
247 SetPlane(buffer->MutableDataY(), plane_colors[0], | |
248 width, height, buffer->StrideY()); | |
249 | |
250 SetPlane(buffer->MutableDataU(), plane_colors[1], | |
251 chroma_width, chroma_height, | |
252 buffer->StrideU()); | |
253 | |
254 SetPlane(buffer->MutableDataV(), plane_colors[2], | |
255 chroma_width, chroma_height, | |
256 buffer->StrideV()); | |
257 } | |
258 | |
259 static void DefaultSettings(VideoCodec* settings, | 245 static void DefaultSettings(VideoCodec* settings, |
260 const int* temporal_layer_profile) { | 246 const int* temporal_layer_profile) { |
261 assert(settings); | 247 assert(settings); |
262 memset(settings, 0, sizeof(VideoCodec)); | 248 memset(settings, 0, sizeof(VideoCodec)); |
263 strncpy(settings->plName, "VP8", 4); | 249 strncpy(settings->plName, "VP8", 4); |
264 settings->codecType = kVideoCodecVP8; | 250 settings->codecType = kVideoCodecVP8; |
265 // 96 to 127 dynamic payload types for video codecs | 251 // 96 to 127 dynamic payload types for video codecs |
266 settings->plType = 120; | 252 settings->plType = 120; |
267 settings->startBitrate = 300; | 253 settings->startBitrate = 300; |
268 settings->minBitrate = 30; | 254 settings->minBitrate = 30; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 298 |
313 virtual void SetUpCodec(const int* temporal_layer_profile) { | 299 virtual void SetUpCodec(const int* temporal_layer_profile) { |
314 encoder_->RegisterEncodeCompleteCallback(&encoder_callback_); | 300 encoder_->RegisterEncodeCompleteCallback(&encoder_callback_); |
315 decoder_->RegisterDecodeCompleteCallback(&decoder_callback_); | 301 decoder_->RegisterDecodeCompleteCallback(&decoder_callback_); |
316 DefaultSettings(&settings_, temporal_layer_profile); | 302 DefaultSettings(&settings_, temporal_layer_profile); |
317 EXPECT_EQ(0, encoder_->InitEncode(&settings_, 1, 1200)); | 303 EXPECT_EQ(0, encoder_->InitEncode(&settings_, 1, 1200)); |
318 EXPECT_EQ(0, decoder_->InitDecode(&settings_, 1)); | 304 EXPECT_EQ(0, decoder_->InitDecode(&settings_, 1)); |
319 int half_width = (kDefaultWidth + 1) / 2; | 305 int half_width = (kDefaultWidth + 1) / 2; |
320 input_frame_.CreateEmptyFrame(kDefaultWidth, kDefaultHeight, kDefaultWidth, | 306 input_frame_.CreateEmptyFrame(kDefaultWidth, kDefaultHeight, kDefaultWidth, |
321 half_width, half_width); | 307 half_width, half_width); |
322 memset(input_frame_.video_frame_buffer()->MutableDataY(), 0, | 308 memset(input_frame_.buffer(kYPlane), 0, |
323 input_frame_.allocated_size(kYPlane)); | 309 input_frame_.allocated_size(kYPlane)); |
324 memset(input_frame_.video_frame_buffer()->MutableDataU(), 0, | 310 memset(input_frame_.buffer(kUPlane), 0, |
325 input_frame_.allocated_size(kUPlane)); | 311 input_frame_.allocated_size(kUPlane)); |
326 memset(input_frame_.video_frame_buffer()->MutableDataV(), 0, | 312 memset(input_frame_.buffer(kVPlane), 0, |
327 input_frame_.allocated_size(kVPlane)); | 313 input_frame_.allocated_size(kVPlane)); |
328 } | 314 } |
329 | 315 |
330 virtual void TearDown() { | 316 virtual void TearDown() { |
331 encoder_->Release(); | 317 encoder_->Release(); |
332 decoder_->Release(); | 318 decoder_->Release(); |
333 } | 319 } |
334 | 320 |
335 void ExpectStreams(FrameType frame_type, int expected_video_streams) { | 321 void ExpectStreams(FrameType frame_type, int expected_video_streams) { |
336 ASSERT_GE(expected_video_streams, 0); | 322 ASSERT_GE(expected_video_streams, 0); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 settings_.height = height; | 548 settings_.height = height; |
563 for (int i = 0; i < settings_.numberOfSimulcastStreams - 1; ++i) { | 549 for (int i = 0; i < settings_.numberOfSimulcastStreams - 1; ++i) { |
564 settings_.simulcastStream[i].maxBitrate = 0; | 550 settings_.simulcastStream[i].maxBitrate = 0; |
565 settings_.simulcastStream[i].width = settings_.width; | 551 settings_.simulcastStream[i].width = settings_.width; |
566 settings_.simulcastStream[i].height = settings_.height; | 552 settings_.simulcastStream[i].height = settings_.height; |
567 } | 553 } |
568 // Setting input image to new resolution. | 554 // Setting input image to new resolution. |
569 int half_width = (settings_.width + 1) / 2; | 555 int half_width = (settings_.width + 1) / 2; |
570 input_frame_.CreateEmptyFrame(settings_.width, settings_.height, | 556 input_frame_.CreateEmptyFrame(settings_.width, settings_.height, |
571 settings_.width, half_width, half_width); | 557 settings_.width, half_width, half_width); |
572 memset(input_frame_.video_frame_buffer()->MutableDataY(), 0, | 558 memset(input_frame_.buffer(kYPlane), 0, |
573 input_frame_.allocated_size(kYPlane)); | 559 input_frame_.allocated_size(kYPlane)); |
574 memset(input_frame_.video_frame_buffer()->MutableDataU(), 0, | 560 memset(input_frame_.buffer(kUPlane), 0, |
575 input_frame_.allocated_size(kUPlane)); | 561 input_frame_.allocated_size(kUPlane)); |
576 memset(input_frame_.video_frame_buffer()->MutableDataV(), 0, | 562 memset(input_frame_.buffer(kVPlane), 0, |
577 input_frame_.allocated_size(kVPlane)); | 563 input_frame_.allocated_size(kVPlane)); |
578 | 564 |
579 // The for loop above did not set the bitrate of the highest layer. | 565 // The for loop above did not set the bitrate of the highest layer. |
580 settings_.simulcastStream[settings_.numberOfSimulcastStreams - 1] | 566 settings_.simulcastStream[settings_.numberOfSimulcastStreams - 1] |
581 .maxBitrate = 0; | 567 .maxBitrate = 0; |
582 // The highest layer has to correspond to the non-simulcast resolution. | 568 // The highest layer has to correspond to the non-simulcast resolution. |
583 settings_.simulcastStream[settings_.numberOfSimulcastStreams - 1].width = | 569 settings_.simulcastStream[settings_.numberOfSimulcastStreams - 1].width = |
584 settings_.width; | 570 settings_.width; |
585 settings_.simulcastStream[settings_.numberOfSimulcastStreams - 1].height = | 571 settings_.simulcastStream[settings_.numberOfSimulcastStreams - 1].height = |
586 settings_.height; | 572 settings_.height; |
(...skipping 16 matching lines...) Expand all Loading... |
603 DefaultSettings(&settings_, kDefaultTemporalLayerProfile); | 589 DefaultSettings(&settings_, kDefaultTemporalLayerProfile); |
604 // Start at the lowest bitrate for enabling base stream. | 590 // Start at the lowest bitrate for enabling base stream. |
605 settings_.startBitrate = kMinBitrates[0]; | 591 settings_.startBitrate = kMinBitrates[0]; |
606 EXPECT_EQ(0, encoder_->InitEncode(&settings_, 1, 1200)); | 592 EXPECT_EQ(0, encoder_->InitEncode(&settings_, 1, 1200)); |
607 encoder_->SetRates(settings_.startBitrate, 30); | 593 encoder_->SetRates(settings_.startBitrate, 30); |
608 ExpectStreams(kVideoFrameKey, 1); | 594 ExpectStreams(kVideoFrameKey, 1); |
609 // Resize |input_frame_| to the new resolution. | 595 // Resize |input_frame_| to the new resolution. |
610 half_width = (settings_.width + 1) / 2; | 596 half_width = (settings_.width + 1) / 2; |
611 input_frame_.CreateEmptyFrame(settings_.width, settings_.height, | 597 input_frame_.CreateEmptyFrame(settings_.width, settings_.height, |
612 settings_.width, half_width, half_width); | 598 settings_.width, half_width, half_width); |
613 memset(input_frame_.video_frame_buffer()->MutableDataY(), 0, | 599 memset(input_frame_.buffer(kYPlane), 0, |
614 input_frame_.allocated_size(kYPlane)); | 600 input_frame_.allocated_size(kYPlane)); |
615 memset(input_frame_.video_frame_buffer()->MutableDataU(), 0, | 601 memset(input_frame_.buffer(kUPlane), 0, |
616 input_frame_.allocated_size(kUPlane)); | 602 input_frame_.allocated_size(kUPlane)); |
617 memset(input_frame_.video_frame_buffer()->MutableDataV(), 0, | 603 memset(input_frame_.buffer(kVPlane), 0, |
618 input_frame_.allocated_size(kVPlane)); | 604 input_frame_.allocated_size(kVPlane)); |
619 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, &frame_types)); | 605 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, &frame_types)); |
620 } | 606 } |
621 | 607 |
622 void TestSwitchingToOneStream() { SwitchingToOneStream(1024, 768); } | 608 void TestSwitchingToOneStream() { SwitchingToOneStream(1024, 768); } |
623 | 609 |
624 void TestSwitchingToOneOddStream() { SwitchingToOneStream(1023, 769); } | 610 void TestSwitchingToOneOddStream() { SwitchingToOneStream(1023, 769); } |
625 | 611 |
626 void TestSwitchingToOneSmallStream() { SwitchingToOneStream(4, 4); } | 612 void TestSwitchingToOneSmallStream() { SwitchingToOneStream(4, 4); } |
627 | 613 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 encoder_->RegisterEncodeCompleteCallback(&encoder_callback); | 684 encoder_->RegisterEncodeCompleteCallback(&encoder_callback); |
699 decoder_->RegisterDecodeCompleteCallback(&decoder_callback); | 685 decoder_->RegisterDecodeCompleteCallback(&decoder_callback); |
700 | 686 |
701 encoder_->SetRates(kMaxBitrates[2], 30); // To get all three streams. | 687 encoder_->SetRates(kMaxBitrates[2], 30); // To get all three streams. |
702 | 688 |
703 // Set color. | 689 // Set color. |
704 int plane_offset[kNumOfPlanes]; | 690 int plane_offset[kNumOfPlanes]; |
705 plane_offset[kYPlane] = kColorY; | 691 plane_offset[kYPlane] = kColorY; |
706 plane_offset[kUPlane] = kColorU; | 692 plane_offset[kUPlane] = kColorU; |
707 plane_offset[kVPlane] = kColorV; | 693 plane_offset[kVPlane] = kColorV; |
708 CreateImage(input_frame_.video_frame_buffer(), plane_offset); | 694 CreateImage(&input_frame_, plane_offset); |
709 | 695 |
710 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, NULL)); | 696 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, NULL)); |
711 int picture_id = -1; | 697 int picture_id = -1; |
712 int temporal_layer = -1; | 698 int temporal_layer = -1; |
713 bool layer_sync = false; | 699 bool layer_sync = false; |
714 encoder_callback.GetLastEncodedFrameInfo(&picture_id, &temporal_layer, | 700 encoder_callback.GetLastEncodedFrameInfo(&picture_id, &temporal_layer, |
715 &layer_sync, 0); | 701 &layer_sync, 0); |
716 EXPECT_EQ(0, temporal_layer); | 702 EXPECT_EQ(0, temporal_layer); |
717 EXPECT_TRUE(layer_sync); | 703 EXPECT_TRUE(layer_sync); |
718 int key_frame_picture_id = picture_id; | 704 int key_frame_picture_id = picture_id; |
719 | 705 |
720 // Change color. | 706 // Change color. |
721 plane_offset[kYPlane] += 1; | 707 plane_offset[kYPlane] += 1; |
722 plane_offset[kUPlane] += 1; | 708 plane_offset[kUPlane] += 1; |
723 plane_offset[kVPlane] += 1; | 709 plane_offset[kVPlane] += 1; |
724 CreateImage(input_frame_.video_frame_buffer(), plane_offset); | 710 CreateImage(&input_frame_, plane_offset); |
725 input_frame_.set_timestamp(input_frame_.timestamp() + 3000); | 711 input_frame_.set_timestamp(input_frame_.timestamp() + 3000); |
726 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, NULL)); | 712 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, NULL)); |
727 | 713 |
728 // Change color. | 714 // Change color. |
729 plane_offset[kYPlane] += 1; | 715 plane_offset[kYPlane] += 1; |
730 plane_offset[kUPlane] += 1; | 716 plane_offset[kUPlane] += 1; |
731 plane_offset[kVPlane] += 1; | 717 plane_offset[kVPlane] += 1; |
732 CreateImage(input_frame_.video_frame_buffer(), plane_offset); | 718 CreateImage(&input_frame_, plane_offset); |
733 | 719 |
734 input_frame_.set_timestamp(input_frame_.timestamp() + 3000); | 720 input_frame_.set_timestamp(input_frame_.timestamp() + 3000); |
735 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, NULL)); | 721 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, NULL)); |
736 | 722 |
737 // Change color. | 723 // Change color. |
738 plane_offset[kYPlane] += 1; | 724 plane_offset[kYPlane] += 1; |
739 plane_offset[kUPlane] += 1; | 725 plane_offset[kUPlane] += 1; |
740 plane_offset[kVPlane] += 1; | 726 plane_offset[kVPlane] += 1; |
741 CreateImage(input_frame_.video_frame_buffer(), plane_offset); | 727 CreateImage(&input_frame_, plane_offset); |
742 | 728 |
743 input_frame_.set_timestamp(input_frame_.timestamp() + 3000); | 729 input_frame_.set_timestamp(input_frame_.timestamp() + 3000); |
744 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, NULL)); | 730 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, NULL)); |
745 | 731 |
746 CodecSpecificInfo codec_specific; | 732 CodecSpecificInfo codec_specific; |
747 codec_specific.codecType = kVideoCodecVP8; | 733 codec_specific.codecType = kVideoCodecVP8; |
748 codec_specific.codecSpecific.VP8.hasReceivedRPSI = true; | 734 codec_specific.codecSpecific.VP8.hasReceivedRPSI = true; |
749 // Must match last key frame to trigger. | 735 // Must match last key frame to trigger. |
750 codec_specific.codecSpecific.VP8.pictureIdRPSI = key_frame_picture_id; | 736 codec_specific.codecSpecific.VP8.pictureIdRPSI = key_frame_picture_id; |
751 | 737 |
752 // Change color back to original. | 738 // Change color back to original. |
753 plane_offset[kYPlane] = kColorY; | 739 plane_offset[kYPlane] = kColorY; |
754 plane_offset[kUPlane] = kColorU; | 740 plane_offset[kUPlane] = kColorU; |
755 plane_offset[kVPlane] = kColorV; | 741 plane_offset[kVPlane] = kColorV; |
756 CreateImage(input_frame_.video_frame_buffer(), plane_offset); | 742 CreateImage(&input_frame_, plane_offset); |
757 | 743 |
758 input_frame_.set_timestamp(input_frame_.timestamp() + 3000); | 744 input_frame_.set_timestamp(input_frame_.timestamp() + 3000); |
759 EXPECT_EQ(0, encoder_->Encode(input_frame_, &codec_specific, NULL)); | 745 EXPECT_EQ(0, encoder_->Encode(input_frame_, &codec_specific, NULL)); |
760 | 746 |
761 EncodedImage encoded_frame; | 747 EncodedImage encoded_frame; |
762 encoder_callback.GetLastEncodedKeyFrame(&encoded_frame); | 748 encoder_callback.GetLastEncodedKeyFrame(&encoded_frame); |
763 decoder_->Decode(encoded_frame, false, NULL); | 749 decoder_->Decode(encoded_frame, false, NULL); |
764 encoder_callback.GetLastEncodedFrame(&encoded_frame); | 750 encoder_callback.GetLastEncodedFrame(&encoded_frame); |
765 decoder_->Decode(encoded_frame, false, NULL); | 751 decoder_->Decode(encoded_frame, false, NULL); |
766 EXPECT_EQ(2, decoder_callback.DecodedFrames()); | 752 EXPECT_EQ(2, decoder_callback.DecodedFrames()); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 // 1. stride > width 2. stride_y != stride_uv/2 | 891 // 1. stride > width 2. stride_y != stride_uv/2 |
906 int stride_y = kDefaultWidth + 20; | 892 int stride_y = kDefaultWidth + 20; |
907 int stride_uv = ((kDefaultWidth + 1) / 2) + 5; | 893 int stride_uv = ((kDefaultWidth + 1) / 2) + 5; |
908 input_frame_.CreateEmptyFrame(kDefaultWidth, kDefaultHeight, stride_y, | 894 input_frame_.CreateEmptyFrame(kDefaultWidth, kDefaultHeight, stride_y, |
909 stride_uv, stride_uv); | 895 stride_uv, stride_uv); |
910 // Set color. | 896 // Set color. |
911 int plane_offset[kNumOfPlanes]; | 897 int plane_offset[kNumOfPlanes]; |
912 plane_offset[kYPlane] = kColorY; | 898 plane_offset[kYPlane] = kColorY; |
913 plane_offset[kUPlane] = kColorU; | 899 plane_offset[kUPlane] = kColorU; |
914 plane_offset[kVPlane] = kColorV; | 900 plane_offset[kVPlane] = kColorV; |
915 CreateImage(input_frame_.video_frame_buffer(), plane_offset); | 901 CreateImage(&input_frame_, plane_offset); |
916 | 902 |
917 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, NULL)); | 903 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, NULL)); |
918 | 904 |
919 // Change color. | 905 // Change color. |
920 plane_offset[kYPlane] += 1; | 906 plane_offset[kYPlane] += 1; |
921 plane_offset[kUPlane] += 1; | 907 plane_offset[kUPlane] += 1; |
922 plane_offset[kVPlane] += 1; | 908 plane_offset[kVPlane] += 1; |
923 CreateImage(input_frame_.video_frame_buffer(), plane_offset); | 909 CreateImage(&input_frame_, plane_offset); |
924 input_frame_.set_timestamp(input_frame_.timestamp() + 3000); | 910 input_frame_.set_timestamp(input_frame_.timestamp() + 3000); |
925 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, NULL)); | 911 EXPECT_EQ(0, encoder_->Encode(input_frame_, NULL, NULL)); |
926 | 912 |
927 EncodedImage encoded_frame; | 913 EncodedImage encoded_frame; |
928 // Only encoding one frame - so will be a key frame. | 914 // Only encoding one frame - so will be a key frame. |
929 encoder_callback.GetLastEncodedKeyFrame(&encoded_frame); | 915 encoder_callback.GetLastEncodedKeyFrame(&encoded_frame); |
930 EXPECT_EQ(0, decoder_->Decode(encoded_frame, false, NULL)); | 916 EXPECT_EQ(0, decoder_->Decode(encoded_frame, false, NULL)); |
931 encoder_callback.GetLastEncodedFrame(&encoded_frame); | 917 encoder_callback.GetLastEncodedFrame(&encoded_frame); |
932 decoder_->Decode(encoded_frame, false, NULL); | 918 decoder_->Decode(encoded_frame, false, NULL); |
933 EXPECT_EQ(2, decoder_callback.DecodedFrames()); | 919 EXPECT_EQ(2, decoder_callback.DecodedFrames()); |
(...skipping 28 matching lines...) Expand all Loading... |
962 std::unique_ptr<VP8Decoder> decoder_; | 948 std::unique_ptr<VP8Decoder> decoder_; |
963 MockDecodedImageCallback decoder_callback_; | 949 MockDecodedImageCallback decoder_callback_; |
964 VideoCodec settings_; | 950 VideoCodec settings_; |
965 VideoFrame input_frame_; | 951 VideoFrame input_frame_; |
966 }; | 952 }; |
967 | 953 |
968 } // namespace testing | 954 } // namespace testing |
969 } // namespace webrtc | 955 } // namespace webrtc |
970 | 956 |
971 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_ | 957 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_ |
OLD | NEW |