Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2.cc

Issue 2521203002: Move VideoDecoder::Create() logic to separate internal video decoder factory (Closed)
Patch Set: Add unittest Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 old_decoders->pop_back(); 2245 old_decoders->pop_back();
2245 return decoder; 2246 return decoder;
2246 } 2247 }
2247 } 2248 }
2248 2249
2249 if (external_decoder_factory_ != NULL) { 2250 if (external_decoder_factory_ != NULL) {
2250 webrtc::VideoDecoder* decoder = 2251 webrtc::VideoDecoder* decoder =
2251 external_decoder_factory_->CreateVideoDecoderWithParams( 2252 external_decoder_factory_->CreateVideoDecoderWithParams(
2252 type, {stream_params_.id}); 2253 type, {stream_params_.id});
2253 if (decoder != NULL) { 2254 if (decoder != NULL) {
2254 return AllocatedDecoder(decoder, type, true); 2255 return AllocatedDecoder(decoder, type, true /* is_external */);
2255 } 2256 }
2256 } 2257 }
2257 2258
2258 if (type == webrtc::kVideoCodecVP8) { 2259 InternalDecoderFactory internal_decoder_factory;
2259 return AllocatedDecoder( 2260 return AllocatedDecoder(internal_decoder_factory.CreateVideoDecoderWithParams(
2260 webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kVp8), type, false); 2261 type, {stream_params_.id}),
2261 } 2262 type, false /* is_external */);
2262
2263 if (type == webrtc::kVideoCodecVP9) {
2264 return AllocatedDecoder(
2265 webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kVp9), type, false);
2266 }
2267
2268 if (type == webrtc::kVideoCodecH264) {
2269 return AllocatedDecoder(
2270 webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kH264), type, false);
2271 }
2272
2273 return AllocatedDecoder(
2274 webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kUnsupportedCodec),
2275 webrtc::kVideoCodecUnknown, false);
2276 } 2263 }
2277 2264
2278 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::ConfigureCodecs( 2265 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::ConfigureCodecs(
2279 const std::vector<VideoCodecSettings>& recv_codecs, 2266 const std::vector<VideoCodecSettings>& recv_codecs,
2280 std::vector<AllocatedDecoder>* old_decoders) { 2267 std::vector<AllocatedDecoder>* old_decoders) {
2281 *old_decoders = allocated_decoders_; 2268 *old_decoders = allocated_decoders_;
2282 allocated_decoders_.clear(); 2269 allocated_decoders_.clear();
2283 config_.decoders.clear(); 2270 config_.decoders.clear();
2284 for (size_t i = 0; i < recv_codecs.size(); ++i) { 2271 for (size_t i = 0; i < recv_codecs.size(); ++i) {
2285 AllocatedDecoder allocated_decoder = 2272 AllocatedDecoder allocated_decoder =
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
2603 rtx_mapping[video_codecs[i].codec.id] != 2590 rtx_mapping[video_codecs[i].codec.id] !=
2604 ulpfec_config.red_payload_type) { 2591 ulpfec_config.red_payload_type) {
2605 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2592 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2606 } 2593 }
2607 } 2594 }
2608 2595
2609 return video_codecs; 2596 return video_codecs;
2610 } 2597 }
2611 2598
2612 } // namespace cricket 2599 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/videodecodersoftwarefallbackwrapper.cc ('k') | webrtc/test/encoder_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698