Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / cast / test / utility / default_config.cc
blobccb60a4624a82b1644476a64a98ff059fed6b846
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "media/cast/test/utility/default_config.h"
7 #include "base/bind.h"
8 #include "media/cast/net/cast_transport_config.h"
10 namespace {
12 void CreateVideoEncodeAccelerator(
13 const media::cast::ReceiveVideoEncodeAcceleratorCallback& callback) {
14 // Do nothing.
17 void CreateVideoEncodeMemory(
18 size_t size,
19 const media::cast::ReceiveVideoEncodeMemoryCallback& callback) {
20 // Do nothing.
23 } // namespace
25 namespace media {
26 namespace cast {
28 FrameReceiverConfig GetDefaultAudioReceiverConfig() {
29 FrameReceiverConfig config;
30 config.receiver_ssrc = 2;
31 config.sender_ssrc = 1;
32 config.rtp_max_delay_ms = kDefaultRtpMaxDelayMs;
33 config.rtp_payload_type = 127;
34 config.rtp_timebase = 48000;
35 config.channels = 2;
36 config.target_frame_rate = 100; // 10ms of signal per frame
37 config.codec = media::cast::CODEC_AUDIO_OPUS;
38 return config;
41 FrameReceiverConfig GetDefaultVideoReceiverConfig() {
42 FrameReceiverConfig config;
43 config.receiver_ssrc = 12;
44 config.sender_ssrc = 11;
45 config.rtp_max_delay_ms = kDefaultRtpMaxDelayMs;
46 config.rtp_payload_type = 96;
47 config.rtp_timebase = kVideoFrequency;
48 config.channels = 1;
49 config.target_frame_rate = kDefaultMaxFrameRate;
50 config.codec = media::cast::CODEC_VIDEO_VP8;
51 return config;
54 AudioSenderConfig GetDefaultAudioSenderConfig() {
55 FrameReceiverConfig recv_config = GetDefaultAudioReceiverConfig();
56 AudioSenderConfig config;
57 config.ssrc = recv_config.sender_ssrc;
58 config.receiver_ssrc = recv_config.receiver_ssrc;
59 config.rtp_payload_type = recv_config.rtp_payload_type;
60 config.use_external_encoder = false;
61 config.frequency = recv_config.rtp_timebase;
62 config.channels = recv_config.channels;
63 config.bitrate = kDefaultAudioEncoderBitrate;
64 config.codec = recv_config.codec;
65 config.max_playout_delay =
66 base::TimeDelta::FromMilliseconds(kDefaultRtpMaxDelayMs);
67 return config;
70 VideoSenderConfig GetDefaultVideoSenderConfig() {
71 FrameReceiverConfig recv_config = GetDefaultVideoReceiverConfig();
72 VideoSenderConfig config;
73 config.ssrc = recv_config.sender_ssrc;
74 config.receiver_ssrc = recv_config.receiver_ssrc;
75 config.rtp_payload_type = recv_config.rtp_payload_type;
76 config.use_external_encoder = false;
77 config.max_bitrate = 4000000;
78 config.min_bitrate = 2000000;
79 config.start_bitrate = 4000000;
80 config.max_frame_rate = recv_config.target_frame_rate;
81 config.max_number_of_video_buffers_used = 1;
82 config.codec = recv_config.codec;
83 config.number_of_encode_threads = 2;
84 config.max_playout_delay =
85 base::TimeDelta::FromMilliseconds(kDefaultRtpMaxDelayMs);
86 return config;
89 CreateVideoEncodeAcceleratorCallback
90 CreateDefaultVideoEncodeAcceleratorCallback() {
91 return base::Bind(&CreateVideoEncodeAccelerator);
94 CreateVideoEncodeMemoryCallback CreateDefaultVideoEncodeMemoryCallback() {
95 return base::Bind(&CreateVideoEncodeMemory);
98 } // namespace cast
99 } // namespace media