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

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

Issue 2772033002: Add content type information to encoded images and corresponding rtp extension header (Closed)
Patch Set: Fix Mac CE Created 3 years, 8 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 encoder_->RegisterEncodeCompleteCallback(&encoder_callback_); 257 encoder_->RegisterEncodeCompleteCallback(&encoder_callback_);
258 decoder_->RegisterDecodeCompleteCallback(&decoder_callback_); 258 decoder_->RegisterDecodeCompleteCallback(&decoder_callback_);
259 DefaultSettings(&settings_, temporal_layer_profile); 259 DefaultSettings(&settings_, temporal_layer_profile);
260 SetUpRateAllocator(); 260 SetUpRateAllocator();
261 EXPECT_EQ(0, encoder_->InitEncode(&settings_, 1, 1200)); 261 EXPECT_EQ(0, encoder_->InitEncode(&settings_, 1, 1200));
262 EXPECT_EQ(0, decoder_->InitDecode(&settings_, 1)); 262 EXPECT_EQ(0, decoder_->InitDecode(&settings_, 1));
263 int half_width = (kDefaultWidth + 1) / 2; 263 int half_width = (kDefaultWidth + 1) / 2;
264 input_buffer_ = I420Buffer::Create(kDefaultWidth, kDefaultHeight, 264 input_buffer_ = I420Buffer::Create(kDefaultWidth, kDefaultHeight,
265 kDefaultWidth, half_width, half_width); 265 kDefaultWidth, half_width, half_width);
266 input_buffer_->InitializeData(); 266 input_buffer_->InitializeData();
267 input_frame_.reset( 267 input_frame_.reset(new VideoFrame(input_buffer_, 0, 0,
268 new VideoFrame(input_buffer_, 0, 0, webrtc::kVideoRotation_0)); 268 webrtc::kVideoRotation_0,
269 webrtc::VideoContentType::kDefault));
269 } 270 }
270 271
271 void SetUpRateAllocator() { 272 void SetUpRateAllocator() {
272 TemporalLayersFactory* tl_factory = new TemporalLayersFactory(); 273 TemporalLayersFactory* tl_factory = new TemporalLayersFactory();
273 rate_allocator_.reset(new SimulcastRateAllocator( 274 rate_allocator_.reset(new SimulcastRateAllocator(
274 settings_, std::unique_ptr<TemporalLayersFactory>(tl_factory))); 275 settings_, std::unique_ptr<TemporalLayersFactory>(tl_factory)));
275 settings_.VP8()->tl_factory = tl_factory; 276 settings_.VP8()->tl_factory = tl_factory;
276 } 277 }
277 278
278 void SetRates(uint32_t bitrate_kbps, uint32_t fps) { 279 void SetRates(uint32_t bitrate_kbps, uint32_t fps) {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 settings_.simulcastStream[i].maxBitrate = 0; 512 settings_.simulcastStream[i].maxBitrate = 0;
512 settings_.simulcastStream[i].width = settings_.width; 513 settings_.simulcastStream[i].width = settings_.width;
513 settings_.simulcastStream[i].height = settings_.height; 514 settings_.simulcastStream[i].height = settings_.height;
514 } 515 }
515 // Setting input image to new resolution. 516 // Setting input image to new resolution.
516 int half_width = (settings_.width + 1) / 2; 517 int half_width = (settings_.width + 1) / 2;
517 input_buffer_ = I420Buffer::Create(settings_.width, settings_.height, 518 input_buffer_ = I420Buffer::Create(settings_.width, settings_.height,
518 settings_.width, half_width, half_width); 519 settings_.width, half_width, half_width);
519 input_buffer_->InitializeData(); 520 input_buffer_->InitializeData();
520 521
521 input_frame_.reset( 522 input_frame_.reset(new VideoFrame(input_buffer_, 0, 0,
522 new VideoFrame(input_buffer_, 0, 0, webrtc::kVideoRotation_0)); 523 webrtc::kVideoRotation_0,
524 webrtc::VideoContentType::kDefault));
523 525
524 // The for loop above did not set the bitrate of the highest layer. 526 // The for loop above did not set the bitrate of the highest layer.
525 settings_.simulcastStream[settings_.numberOfSimulcastStreams - 1] 527 settings_.simulcastStream[settings_.numberOfSimulcastStreams - 1]
526 .maxBitrate = 0; 528 .maxBitrate = 0;
527 // The highest layer has to correspond to the non-simulcast resolution. 529 // The highest layer has to correspond to the non-simulcast resolution.
528 settings_.simulcastStream[settings_.numberOfSimulcastStreams - 1].width = 530 settings_.simulcastStream[settings_.numberOfSimulcastStreams - 1].width =
529 settings_.width; 531 settings_.width;
530 settings_.simulcastStream[settings_.numberOfSimulcastStreams - 1].height = 532 settings_.simulcastStream[settings_.numberOfSimulcastStreams - 1].height =
531 settings_.height; 533 settings_.height;
532 SetUpRateAllocator(); 534 SetUpRateAllocator();
(...skipping 20 matching lines...) Expand all
553 settings_.startBitrate = kMinBitrates[0]; 555 settings_.startBitrate = kMinBitrates[0];
554 SetUpRateAllocator(); 556 SetUpRateAllocator();
555 EXPECT_EQ(0, encoder_->InitEncode(&settings_, 1, 1200)); 557 EXPECT_EQ(0, encoder_->InitEncode(&settings_, 1, 1200));
556 SetRates(settings_.startBitrate, 30); 558 SetRates(settings_.startBitrate, 30);
557 ExpectStreams(kVideoFrameKey, 1); 559 ExpectStreams(kVideoFrameKey, 1);
558 // Resize |input_frame_| to the new resolution. 560 // Resize |input_frame_| to the new resolution.
559 half_width = (settings_.width + 1) / 2; 561 half_width = (settings_.width + 1) / 2;
560 input_buffer_ = I420Buffer::Create(settings_.width, settings_.height, 562 input_buffer_ = I420Buffer::Create(settings_.width, settings_.height,
561 settings_.width, half_width, half_width); 563 settings_.width, half_width, half_width);
562 input_buffer_->InitializeData(); 564 input_buffer_->InitializeData();
563 input_frame_.reset( 565 input_frame_.reset(new VideoFrame(input_buffer_, 0, 0,
564 new VideoFrame(input_buffer_, 0, 0, webrtc::kVideoRotation_0)); 566 webrtc::kVideoRotation_0,
567 webrtc::VideoContentType::kDefault));
565 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, &frame_types)); 568 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, &frame_types));
566 } 569 }
567 570
568 void TestSwitchingToOneStream() { SwitchingToOneStream(1024, 768); } 571 void TestSwitchingToOneStream() { SwitchingToOneStream(1024, 768); }
569 572
570 void TestSwitchingToOneOddStream() { SwitchingToOneStream(1023, 769); } 573 void TestSwitchingToOneOddStream() { SwitchingToOneStream(1023, 769); }
571 574
572 void TestSwitchingToOneSmallStream() { SwitchingToOneStream(4, 4); } 575 void TestSwitchingToOneSmallStream() { SwitchingToOneStream(4, 4); }
573 576
574 // Test the layer pattern and sync flag for various spatial-temporal patterns. 577 // Test the layer pattern and sync flag for various spatial-temporal patterns.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 encoder_->RegisterEncodeCompleteCallback(&encoder_callback); 708 encoder_->RegisterEncodeCompleteCallback(&encoder_callback);
706 decoder_->RegisterDecodeCompleteCallback(&decoder_callback); 709 decoder_->RegisterDecodeCompleteCallback(&decoder_callback);
707 710
708 SetRates(kMaxBitrates[2], 30); // To get all three streams. 711 SetRates(kMaxBitrates[2], 30); // To get all three streams.
709 // Setting two (possibly) problematic use cases for stride: 712 // Setting two (possibly) problematic use cases for stride:
710 // 1. stride > width 2. stride_y != stride_uv/2 713 // 1. stride > width 2. stride_y != stride_uv/2
711 int stride_y = kDefaultWidth + 20; 714 int stride_y = kDefaultWidth + 20;
712 int stride_uv = ((kDefaultWidth + 1) / 2) + 5; 715 int stride_uv = ((kDefaultWidth + 1) / 2) + 5;
713 input_buffer_ = I420Buffer::Create(kDefaultWidth, kDefaultHeight, stride_y, 716 input_buffer_ = I420Buffer::Create(kDefaultWidth, kDefaultHeight, stride_y,
714 stride_uv, stride_uv); 717 stride_uv, stride_uv);
715 input_frame_.reset( 718 input_frame_.reset(new VideoFrame(input_buffer_, 0, 0,
716 new VideoFrame(input_buffer_, 0, 0, webrtc::kVideoRotation_0)); 719 webrtc::kVideoRotation_0,
720 webrtc::VideoContentType::kDefault));
717 721
718 // Set color. 722 // Set color.
719 int plane_offset[kNumOfPlanes]; 723 int plane_offset[kNumOfPlanes];
720 plane_offset[kYPlane] = kColorY; 724 plane_offset[kYPlane] = kColorY;
721 plane_offset[kUPlane] = kColorU; 725 plane_offset[kUPlane] = kColorU;
722 plane_offset[kVPlane] = kColorV; 726 plane_offset[kVPlane] = kColorV;
723 CreateImage(input_buffer_, plane_offset); 727 CreateImage(input_buffer_, plane_offset);
724 728
725 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL)); 729 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL));
726 730
(...skipping 21 matching lines...) Expand all
748 VideoCodec settings_; 752 VideoCodec settings_;
749 rtc::scoped_refptr<I420Buffer> input_buffer_; 753 rtc::scoped_refptr<I420Buffer> input_buffer_;
750 std::unique_ptr<VideoFrame> input_frame_; 754 std::unique_ptr<VideoFrame> input_frame_;
751 std::unique_ptr<SimulcastRateAllocator> rate_allocator_; 755 std::unique_ptr<SimulcastRateAllocator> rate_allocator_;
752 }; 756 };
753 757
754 } // namespace testing 758 } // namespace testing
755 } // namespace webrtc 759 } // namespace webrtc
756 760
757 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_ 761 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698