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. 4 5 #include "media/cast/test/utility/default_config.h" 6 7 #include "base/bind.h" 8 #include "media/cast/net/cast_transport_config.h" 9 10 namespace { 11 12 void CreateVideoEncodeAccelerator( 13 const media::cast::ReceiveVideoEncodeAcceleratorCallback& callback) { 14 // Do nothing. 15 } 16 17 void CreateVideoEncodeMemory( 18 size_t size, 19 const media::cast::ReceiveVideoEncodeMemoryCallback& callback) { 20 // Do nothing. 21 } 22 23 } // namespace 24 25 namespace media { 26 namespace cast { 27 28 FrameReceiverConfig GetDefaultAudioReceiverConfig() { 29 FrameReceiverConfig config; 30 config.feedback_ssrc = 2; 31 config.incoming_ssrc = 1; 32 config.rtp_max_delay_ms = kDefaultRtpMaxDelayMs; 33 config.rtp_payload_type = 127; 34 config.frequency = 48000; 35 config.channels = 2; 36 config.max_frame_rate = 100; // 10ms of signal per frame 37 config.codec = media::cast::CODEC_AUDIO_OPUS; 38 return config; 39 } 40 41 FrameReceiverConfig GetDefaultVideoReceiverConfig() { 42 FrameReceiverConfig config; 43 config.feedback_ssrc = 12; 44 config.incoming_ssrc = 11; 45 config.rtp_max_delay_ms = kDefaultRtpMaxDelayMs; 46 config.rtp_payload_type = 96; 47 config.frequency = kVideoFrequency; 48 config.channels = 1; 49 config.max_frame_rate = kDefaultMaxFrameRate; 50 config.codec = media::cast::CODEC_VIDEO_VP8; 51 return config; 52 } 53 54 AudioSenderConfig GetDefaultAudioSenderConfig() { 55 FrameReceiverConfig recv_config = GetDefaultAudioReceiverConfig(); 56 AudioSenderConfig config; 57 config.ssrc = recv_config.incoming_ssrc; 58 config.incoming_feedback_ssrc = recv_config.feedback_ssrc; 59 config.rtp_payload_type = recv_config.rtp_payload_type; 60 config.use_external_encoder = false; 61 config.frequency = recv_config.frequency; 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; 68 } 69 70 VideoSenderConfig GetDefaultVideoSenderConfig() { 71 FrameReceiverConfig recv_config = GetDefaultVideoReceiverConfig(); 72 VideoSenderConfig config; 73 config.ssrc = recv_config.incoming_ssrc; 74 config.incoming_feedback_ssrc = recv_config.feedback_ssrc; 75 config.rtp_payload_type = recv_config.rtp_payload_type; 76 config.use_external_encoder = false; 77 config.width = 1280; 78 config.height = 720; 79 config.max_bitrate = 4000000; 80 config.min_bitrate = 2000000; 81 config.start_bitrate = 4000000; 82 config.max_frame_rate = recv_config.max_frame_rate; 83 config.max_number_of_video_buffers_used = 1; 84 config.codec = recv_config.codec; 85 config.number_of_encode_threads = 2; 86 config.max_playout_delay = 87 base::TimeDelta::FromMilliseconds(kDefaultRtpMaxDelayMs); 88 return config; 89 } 90 91 CreateVideoEncodeAcceleratorCallback 92 CreateDefaultVideoEncodeAcceleratorCallback() { 93 return base::Bind(&CreateVideoEncodeAccelerator); 94 } 95 96 CreateVideoEncodeMemoryCallback CreateDefaultVideoEncodeMemoryCallback() { 97 return base::Bind(&CreateVideoEncodeMemory); 98 } 99 100 } // namespace cast 101 } // namespace media 102