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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h

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

Powered by Google App Engine
This is Rietveld 408576698