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

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

Issue 2492473002: Stop caching supported codecs in WebRtcVideoEngine2 (Closed)
Patch Set: Created 4 years, 1 month 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
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 if (default_recv_ssrc_ != 0) { 536 if (default_recv_ssrc_ != 0) {
537 channel->SetSink(default_recv_ssrc_, default_sink_); 537 channel->SetSink(default_recv_ssrc_, default_sink_);
538 } 538 }
539 } 539 }
540 540
541 WebRtcVideoEngine2::WebRtcVideoEngine2() 541 WebRtcVideoEngine2::WebRtcVideoEngine2()
542 : initialized_(false), 542 : initialized_(false),
543 external_decoder_factory_(NULL), 543 external_decoder_factory_(NULL),
544 external_encoder_factory_(NULL) { 544 external_encoder_factory_(NULL) {
545 LOG(LS_INFO) << "WebRtcVideoEngine2::WebRtcVideoEngine2()"; 545 LOG(LS_INFO) << "WebRtcVideoEngine2::WebRtcVideoEngine2()";
546 video_codecs_ = GetSupportedCodecs(external_encoder_factory_);
547 } 546 }
548 547
549 WebRtcVideoEngine2::~WebRtcVideoEngine2() { 548 WebRtcVideoEngine2::~WebRtcVideoEngine2() {
550 LOG(LS_INFO) << "WebRtcVideoEngine2::~WebRtcVideoEngine2"; 549 LOG(LS_INFO) << "WebRtcVideoEngine2::~WebRtcVideoEngine2";
551 } 550 }
552 551
553 void WebRtcVideoEngine2::Init() { 552 void WebRtcVideoEngine2::Init() {
554 LOG(LS_INFO) << "WebRtcVideoEngine2::Init"; 553 LOG(LS_INFO) << "WebRtcVideoEngine2::Init";
555 initialized_ = true; 554 initialized_ = true;
556 } 555 }
557 556
558 WebRtcVideoChannel2* WebRtcVideoEngine2::CreateChannel( 557 WebRtcVideoChannel2* WebRtcVideoEngine2::CreateChannel(
559 webrtc::Call* call, 558 webrtc::Call* call,
560 const MediaConfig& config, 559 const MediaConfig& config,
561 const VideoOptions& options) { 560 const VideoOptions& options) {
562 RTC_DCHECK(initialized_); 561 RTC_DCHECK(initialized_);
563 LOG(LS_INFO) << "CreateChannel. Options: " << options.ToString(); 562 LOG(LS_INFO) << "CreateChannel. Options: " << options.ToString();
564 return new WebRtcVideoChannel2(call, config, options, 563 return new WebRtcVideoChannel2(call, config, options,
565 external_encoder_factory_, 564 external_encoder_factory_,
566 external_decoder_factory_); 565 external_decoder_factory_);
567 } 566 }
568 567
569 const std::vector<VideoCodec>& WebRtcVideoEngine2::codecs() const { 568 const std::vector<VideoCodec> WebRtcVideoEngine2::codecs() const {
570 return video_codecs_; 569 return GetSupportedCodecs(external_encoder_factory_);
571 } 570 }
572 571
573 RtpCapabilities WebRtcVideoEngine2::GetCapabilities() const { 572 RtpCapabilities WebRtcVideoEngine2::GetCapabilities() const {
574 RtpCapabilities capabilities; 573 RtpCapabilities capabilities;
575 capabilities.header_extensions.push_back( 574 capabilities.header_extensions.push_back(
576 webrtc::RtpExtension(webrtc::RtpExtension::kTimestampOffsetUri, 575 webrtc::RtpExtension(webrtc::RtpExtension::kTimestampOffsetUri,
577 webrtc::RtpExtension::kTimestampOffsetDefaultId)); 576 webrtc::RtpExtension::kTimestampOffsetDefaultId));
578 capabilities.header_extensions.push_back( 577 capabilities.header_extensions.push_back(
579 webrtc::RtpExtension(webrtc::RtpExtension::kAbsSendTimeUri, 578 webrtc::RtpExtension(webrtc::RtpExtension::kAbsSendTimeUri,
580 webrtc::RtpExtension::kAbsSendTimeDefaultId)); 579 webrtc::RtpExtension::kAbsSendTimeDefaultId));
(...skipping 26 matching lines...) Expand all
607 simulcast_encoder_factory_.reset(); 606 simulcast_encoder_factory_.reset();
608 607
609 if (encoder_factory && 608 if (encoder_factory &&
610 WebRtcSimulcastEncoderFactory::UseSimulcastEncoderFactory( 609 WebRtcSimulcastEncoderFactory::UseSimulcastEncoderFactory(
611 encoder_factory->supported_codecs())) { 610 encoder_factory->supported_codecs())) {
612 simulcast_encoder_factory_.reset( 611 simulcast_encoder_factory_.reset(
613 new WebRtcSimulcastEncoderFactory(encoder_factory)); 612 new WebRtcSimulcastEncoderFactory(encoder_factory));
614 encoder_factory = simulcast_encoder_factory_.get(); 613 encoder_factory = simulcast_encoder_factory_.get();
615 } 614 }
616 external_encoder_factory_ = encoder_factory; 615 external_encoder_factory_ = encoder_factory;
617
618 video_codecs_ = GetSupportedCodecs(encoder_factory);
619 } 616 }
620 617
621 static std::vector<VideoCodec> GetSupportedCodecs( 618 static std::vector<VideoCodec> GetSupportedCodecs(
622 const WebRtcVideoEncoderFactory* external_encoder_factory) { 619 const WebRtcVideoEncoderFactory* external_encoder_factory) {
623 std::vector<VideoCodec> supported_codecs = DefaultVideoCodecList(); 620 std::vector<VideoCodec> supported_codecs = DefaultVideoCodecList();
624 621
625 if (external_encoder_factory == nullptr) { 622 if (external_encoder_factory == nullptr) {
626 LOG(LS_INFO) << "Supported codecs: " 623 LOG(LS_INFO) << "Supported codecs: "
627 << CodecVectorToString(supported_codecs); 624 << CodecVectorToString(supported_codecs);
628 return supported_codecs; 625 return supported_codecs;
(...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after
2574 rtx_mapping[video_codecs[i].codec.id] != 2571 rtx_mapping[video_codecs[i].codec.id] !=
2575 ulpfec_config.red_payload_type) { 2572 ulpfec_config.red_payload_type) {
2576 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2573 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2577 } 2574 }
2578 } 2575 }
2579 2576
2580 return video_codecs; 2577 return video_codecs;
2581 } 2578 }
2582 2579
2583 } // namespace cricket 2580 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698