OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2011 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 2947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2958 codec.bitrate = bitrate; | 2958 codec.bitrate = bitrate; |
2959 codec.channels = channels; | 2959 codec.channels = channels; |
2960 AddOrReplaceCodec<AudioContentDescription, cricket::AudioCodec>(audio_desc, | 2960 AddOrReplaceCodec<AudioContentDescription, cricket::AudioCodec>(audio_desc, |
2961 codec); | 2961 codec); |
2962 } | 2962 } |
2963 | 2963 |
2964 // Updates or creates a new codec entry in the video description according to | 2964 // Updates or creates a new codec entry in the video description according to |
2965 // |name|, |width|, |height|, and |framerate|. | 2965 // |name|, |width|, |height|, and |framerate|. |
2966 void UpdateCodec(int payload_type, | 2966 void UpdateCodec(int payload_type, |
2967 const std::string& name, | 2967 const std::string& name, |
2968 int width, | |
2969 int height, | |
2970 int framerate, | |
2971 VideoContentDescription* video_desc) { | 2968 VideoContentDescription* video_desc) { |
2972 // Codec may already be populated with (only) optional parameters | 2969 // Codec may already be populated with (only) optional parameters |
2973 // (from an fmtp). | 2970 // (from an fmtp). |
2974 cricket::VideoCodec codec = | 2971 cricket::VideoCodec codec = |
2975 GetCodecWithPayloadType(video_desc->codecs(), payload_type); | 2972 GetCodecWithPayloadType(video_desc->codecs(), payload_type); |
2976 codec.name = name; | 2973 codec.name = name; |
2977 codec.width = width; | |
2978 codec.height = height; | |
2979 codec.framerate = framerate; | |
2980 AddOrReplaceCodec<VideoContentDescription, cricket::VideoCodec>(video_desc, | 2974 AddOrReplaceCodec<VideoContentDescription, cricket::VideoCodec>(video_desc, |
2981 codec); | 2975 codec); |
2982 } | 2976 } |
2983 | 2977 |
2984 bool ParseRtpmapAttribute(const std::string& line, | 2978 bool ParseRtpmapAttribute(const std::string& line, |
2985 const MediaType media_type, | 2979 const MediaType media_type, |
2986 const std::vector<int>& payload_types, | 2980 const std::vector<int>& payload_types, |
2987 MediaContentDescription* media_desc, | 2981 MediaContentDescription* media_desc, |
2988 SdpParseError* error) { | 2982 SdpParseError* error) { |
2989 std::vector<std::string> fields; | 2983 std::vector<std::string> fields; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3023 error); | 3017 error); |
3024 } | 3018 } |
3025 const std::string& encoding_name = codec_params[0]; | 3019 const std::string& encoding_name = codec_params[0]; |
3026 int clock_rate = 0; | 3020 int clock_rate = 0; |
3027 if (!GetValueFromString(line, codec_params[1], &clock_rate, error)) { | 3021 if (!GetValueFromString(line, codec_params[1], &clock_rate, error)) { |
3028 return false; | 3022 return false; |
3029 } | 3023 } |
3030 if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3024 if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
3031 VideoContentDescription* video_desc = | 3025 VideoContentDescription* video_desc = |
3032 static_cast<VideoContentDescription*>(media_desc); | 3026 static_cast<VideoContentDescription*>(media_desc); |
3033 // TODO: We will send resolution in SDP. For now use | |
3034 // JsepSessionDescription::kMaxVideoCodecWidth and kMaxVideoCodecHeight. | |
3035 UpdateCodec(payload_type, encoding_name, | 3027 UpdateCodec(payload_type, encoding_name, |
3036 JsepSessionDescription::kMaxVideoCodecWidth, | |
3037 JsepSessionDescription::kMaxVideoCodecHeight, | |
3038 JsepSessionDescription::kDefaultVideoCodecFramerate, | |
3039 video_desc); | 3028 video_desc); |
3040 } else if (media_type == cricket::MEDIA_TYPE_AUDIO) { | 3029 } else if (media_type == cricket::MEDIA_TYPE_AUDIO) { |
3041 // RFC 4566 | 3030 // RFC 4566 |
3042 // For audio streams, <encoding parameters> indicates the number | 3031 // For audio streams, <encoding parameters> indicates the number |
3043 // of audio channels. This parameter is OPTIONAL and may be | 3032 // of audio channels. This parameter is OPTIONAL and may be |
3044 // omitted if the number of channels is one, provided that no | 3033 // omitted if the number of channels is one, provided that no |
3045 // additional parameters are needed. | 3034 // additional parameters are needed. |
3046 size_t channels = 1; | 3035 size_t channels = 1; |
3047 if (codec_params.size() == 3) { | 3036 if (codec_params.size() == 3) { |
3048 if (!GetValueFromString(line, codec_params[2], &channels, error)) { | 3037 if (!GetValueFromString(line, codec_params[2], &channels, error)) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3182 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3171 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
3183 media_desc, payload_type, feedback_param); | 3172 media_desc, payload_type, feedback_param); |
3184 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3173 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
3185 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3174 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
3186 media_desc, payload_type, feedback_param); | 3175 media_desc, payload_type, feedback_param); |
3187 } | 3176 } |
3188 return true; | 3177 return true; |
3189 } | 3178 } |
3190 | 3179 |
3191 } // namespace webrtc | 3180 } // namespace webrtc |
OLD | NEW |