| OLD | NEW |
| 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 |
| 11 #include "webrtc/media/engine/webrtcvideoengine2.h" | 11 #include "webrtc/media/engine/webrtcvideoengine2.h" |
| 12 | 12 |
| 13 #include <stdio.h> | 13 #include <stdio.h> |
| 14 #include <algorithm> | 14 #include <algorithm> |
| 15 #include <set> | 15 #include <set> |
| 16 #include <string> | 16 #include <string> |
| 17 #include <utility> | 17 #include <utility> |
| 18 | 18 |
| 19 #include "webrtc/base/copyonwritebuffer.h" | 19 #include "webrtc/base/copyonwritebuffer.h" |
| 20 #include "webrtc/base/logging.h" | 20 #include "webrtc/base/logging.h" |
| 21 #include "webrtc/base/stringutils.h" | 21 #include "webrtc/base/stringutils.h" |
| 22 #include "webrtc/base/timeutils.h" | 22 #include "webrtc/base/timeutils.h" |
| 23 #include "webrtc/base/trace_event.h" | 23 #include "webrtc/base/trace_event.h" |
| 24 #include "webrtc/call.h" | 24 #include "webrtc/call.h" |
| 25 #include "webrtc/common_video/h264/profile_level_id.h" | 25 #include "webrtc/common_video/h264/profile_level_id.h" |
| 26 #include "webrtc/media/engine/constants.h" | 26 #include "webrtc/media/engine/constants.h" |
| 27 #include "webrtc/media/engine/internalencoderfactory.h" | 27 #include "webrtc/media/engine/internalencoderfactory.h" |
| 28 #include "webrtc/media/engine/internaldecoderfactory.h" |
| 28 #include "webrtc/media/engine/simulcast.h" | 29 #include "webrtc/media/engine/simulcast.h" |
| 29 #include "webrtc/media/engine/videoencodersoftwarefallbackwrapper.h" | 30 #include "webrtc/media/engine/videoencodersoftwarefallbackwrapper.h" |
| 30 #include "webrtc/media/engine/videodecodersoftwarefallbackwrapper.h" | 31 #include "webrtc/media/engine/videodecodersoftwarefallbackwrapper.h" |
| 31 #include "webrtc/media/engine/webrtcmediaengine.h" | 32 #include "webrtc/media/engine/webrtcmediaengine.h" |
| 32 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" | 33 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" |
| 33 #include "webrtc/media/engine/webrtcvoiceengine.h" | 34 #include "webrtc/media/engine/webrtcvoiceengine.h" |
| 34 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" | 35 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" |
| 35 #include "webrtc/system_wrappers/include/field_trial.h" | 36 #include "webrtc/system_wrappers/include/field_trial.h" |
| 36 #include "webrtc/video_decoder.h" | 37 #include "webrtc/video_decoder.h" |
| 37 #include "webrtc/video_encoder.h" | 38 #include "webrtc/video_encoder.h" |
| (...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2187 old_decoders->pop_back(); | 2188 old_decoders->pop_back(); |
| 2188 return decoder; | 2189 return decoder; |
| 2189 } | 2190 } |
| 2190 } | 2191 } |
| 2191 | 2192 |
| 2192 if (external_decoder_factory_ != NULL) { | 2193 if (external_decoder_factory_ != NULL) { |
| 2193 webrtc::VideoDecoder* decoder = | 2194 webrtc::VideoDecoder* decoder = |
| 2194 external_decoder_factory_->CreateVideoDecoderWithParams( | 2195 external_decoder_factory_->CreateVideoDecoderWithParams( |
| 2195 type, {stream_params_.id}); | 2196 type, {stream_params_.id}); |
| 2196 if (decoder != NULL) { | 2197 if (decoder != NULL) { |
| 2197 return AllocatedDecoder(decoder, type, true); | 2198 return AllocatedDecoder(decoder, type, true /* is_external */); |
| 2198 } | 2199 } |
| 2199 } | 2200 } |
| 2200 | 2201 |
| 2201 if (type == webrtc::kVideoCodecVP8) { | 2202 InternalDecoderFactory internal_decoder_factory; |
| 2202 return AllocatedDecoder( | 2203 return AllocatedDecoder(internal_decoder_factory.CreateVideoDecoderWithParams( |
| 2203 webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kVp8), type, false); | 2204 type, {stream_params_.id}), |
| 2204 } | 2205 type, false /* is_external */); |
| 2205 | |
| 2206 if (type == webrtc::kVideoCodecVP9) { | |
| 2207 return AllocatedDecoder( | |
| 2208 webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kVp9), type, false); | |
| 2209 } | |
| 2210 | |
| 2211 if (type == webrtc::kVideoCodecH264) { | |
| 2212 return AllocatedDecoder( | |
| 2213 webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kH264), type, false); | |
| 2214 } | |
| 2215 | |
| 2216 return AllocatedDecoder( | |
| 2217 webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kUnsupportedCodec), | |
| 2218 webrtc::kVideoCodecUnknown, false); | |
| 2219 } | 2206 } |
| 2220 | 2207 |
| 2221 void ConfigureDecoderSpecifics(webrtc::VideoReceiveStream::Decoder* decoder, | 2208 void ConfigureDecoderSpecifics(webrtc::VideoReceiveStream::Decoder* decoder, |
| 2222 const cricket::VideoCodec& recv_video_codec) { | 2209 const cricket::VideoCodec& recv_video_codec) { |
| 2223 if (recv_video_codec.name.compare("H264") == 0) { | 2210 if (recv_video_codec.name.compare("H264") == 0) { |
| 2224 auto it = recv_video_codec.params.find("sprop-parameter-sets"); | 2211 auto it = recv_video_codec.params.find("sprop-parameter-sets"); |
| 2225 if (it != recv_video_codec.params.end()) { | 2212 if (it != recv_video_codec.params.end()) { |
| 2226 decoder->decoder_specific.h264_extra_settings = | 2213 decoder->decoder_specific.h264_extra_settings = |
| 2227 rtc::Optional<webrtc::VideoDecoderH264Settings>( | 2214 rtc::Optional<webrtc::VideoDecoderH264Settings>( |
| 2228 webrtc::VideoDecoderH264Settings()); | 2215 webrtc::VideoDecoderH264Settings()); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2549 rtx_mapping[video_codecs[i].codec.id] != | 2536 rtx_mapping[video_codecs[i].codec.id] != |
| 2550 ulpfec_config.red_payload_type) { | 2537 ulpfec_config.red_payload_type) { |
| 2551 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2538 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2552 } | 2539 } |
| 2553 } | 2540 } |
| 2554 | 2541 |
| 2555 return video_codecs; | 2542 return video_codecs; |
| 2556 } | 2543 } |
| 2557 | 2544 |
| 2558 } // namespace cricket | 2545 } // namespace cricket |
| OLD | NEW |