OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 * | |
10 */ | |
11 | |
12 #include "webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.h" | |
13 | |
14 #include "webrtc/test/gtest.h" | |
15 | |
16 namespace webrtc { | |
17 | |
18 namespace { | |
19 | |
20 const int kMaxPayloadSize = 1024; | |
21 | |
22 void SetDefaultSettings(VideoCodec* codec_settings) { | |
23 codec_settings->codecType = kVideoCodecH264; | |
24 codec_settings->maxFramerate = 60; | |
25 codec_settings->width = 640; | |
26 codec_settings->height = 480; | |
27 codec_settings->H264()->packetization_mode = kH264PacketizationMode1; | |
28 // If frame dropping is false, we get a warning that bitrate can't | |
29 // be controlled for RC_QUALITY_MODE; RC_BITRATE_MODE and RC_TIMESTAMP_MODE | |
30 codec_settings->H264()->frameDroppingOn = true; | |
31 codec_settings->targetBitrate = 2000; | |
32 codec_settings->maxBitrate = 4000; | |
33 } | |
34 | |
35 TEST(H264EncoderImplTest, CanInitializeWithDefaultParameters) { | |
36 H264EncoderImpl encoder; | |
37 VideoCodec codec_settings; | |
38 SetDefaultSettings(&codec_settings); | |
39 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | |
40 encoder.InitEncode(&codec_settings, 1, kMaxPayloadSize)); | |
41 } | |
42 | |
43 TEST(H264EncoderImplTest, CanInitializeWithPacketizationMode0) { | |
44 H264EncoderImpl encoder; | |
45 VideoCodec codec_settings; | |
46 SetDefaultSettings(&codec_settings); | |
47 codec_settings.H264()->packetization_mode = kH264PacketizationMode0; | |
48 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | |
49 encoder.InitEncode(&codec_settings, 1, kMaxPayloadSize)); | |
50 } | |
51 | |
52 } // anonymous namespace | |
53 | |
54 } // namespace webrtc | |
OLD | NEW |