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 <algorithm> | 13 #include <algorithm> |
14 #include <set> | 14 #include <set> |
15 #include <string> | 15 #include <string> |
16 | 16 |
| 17 #include "webrtc/base/asyncinvoker.h" |
17 #include "webrtc/base/buffer.h" | 18 #include "webrtc/base/buffer.h" |
18 #include "webrtc/base/logging.h" | 19 #include "webrtc/base/logging.h" |
19 #include "webrtc/base/stringutils.h" | 20 #include "webrtc/base/stringutils.h" |
20 #include "webrtc/base/timeutils.h" | 21 #include "webrtc/base/timeutils.h" |
21 #include "webrtc/base/trace_event.h" | 22 #include "webrtc/base/trace_event.h" |
22 #include "webrtc/call.h" | 23 #include "webrtc/call.h" |
23 #include "webrtc/media/base/videocapturer.h" | 24 #include "webrtc/media/base/videocapturer.h" |
24 #include "webrtc/media/base/videorenderer.h" | 25 #include "webrtc/media/base/videorenderer.h" |
25 #include "webrtc/media/engine/constants.h" | 26 #include "webrtc/media/engine/constants.h" |
26 #include "webrtc/media/engine/simulcast.h" | 27 #include "webrtc/media/engine/simulcast.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 if (width * height <= 320 * 240) { | 308 if (width * height <= 320 * 240) { |
308 return 600; | 309 return 600; |
309 } else if (width * height <= 640 * 480) { | 310 } else if (width * height <= 640 * 480) { |
310 return 1700; | 311 return 1700; |
311 } else if (width * height <= 960 * 540) { | 312 } else if (width * height <= 960 * 540) { |
312 return 2000; | 313 return 2000; |
313 } else { | 314 } else { |
314 return 2500; | 315 return 2500; |
315 } | 316 } |
316 } | 317 } |
| 318 |
317 } // namespace | 319 } // namespace |
318 | 320 |
319 // Constants defined in webrtc/media/engine/constants.h | 321 // Constants defined in webrtc/media/engine/constants.h |
320 // TODO(pbos): Move these to a separate constants.cc file. | 322 // TODO(pbos): Move these to a separate constants.cc file. |
321 const int kMinVideoBitrate = 30; | 323 const int kMinVideoBitrate = 30; |
322 const int kStartVideoBitrate = 300; | 324 const int kStartVideoBitrate = 300; |
323 | 325 |
324 const int kVideoMtu = 1200; | 326 const int kVideoMtu = 1200; |
325 const int kVideoRtpBufferSize = 65536; | 327 const int kVideoRtpBufferSize = 65536; |
326 | 328 |
327 // This constant is really an on/off, lower-level configurable NACK history | 329 // This constant is really an on/off, lower-level configurable NACK history |
328 // duration hasn't been implemented. | 330 // duration hasn't been implemented. |
329 static const int kNackHistoryMs = 1000; | 331 static const int kNackHistoryMs = 1000; |
330 | 332 |
331 static const int kDefaultQpMax = 56; | 333 static const int kDefaultQpMax = 56; |
332 | 334 |
333 static const int kDefaultRtcpReceiverReportSsrc = 1; | 335 static const int kDefaultRtcpReceiverReportSsrc = 1; |
334 | 336 |
| 337 // Reduce wanted maximum number of pixels by at most 4. |
| 338 static const int kMaxCpuDownScale = 4; |
| 339 |
335 std::vector<VideoCodec> DefaultVideoCodecList() { | 340 std::vector<VideoCodec> DefaultVideoCodecList() { |
336 std::vector<VideoCodec> codecs; | 341 std::vector<VideoCodec> codecs; |
337 codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultVp8PlType, | 342 codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultVp8PlType, |
338 kVp8CodecName)); | 343 kVp8CodecName)); |
339 codecs.push_back( | 344 codecs.push_back( |
340 VideoCodec::CreateRtxCodec(kDefaultRtxVp8PlType, kDefaultVp8PlType)); | 345 VideoCodec::CreateRtxCodec(kDefaultRtxVp8PlType, kDefaultVp8PlType)); |
341 if (CodecIsInternallySupported(kVp9CodecName)) { | 346 if (CodecIsInternallySupported(kVp9CodecName)) { |
342 codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultVp9PlType, | 347 codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultVp9PlType, |
343 kVp9CodecName)); | 348 kVp9CodecName)); |
344 codecs.push_back( | 349 codecs.push_back( |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 | 992 |
988 rtc::CritScope stream_lock(&stream_crit_); | 993 rtc::CritScope stream_lock(&stream_crit_); |
989 | 994 |
990 if (!ValidateSendSsrcAvailability(sp)) | 995 if (!ValidateSendSsrcAvailability(sp)) |
991 return false; | 996 return false; |
992 | 997 |
993 for (uint32_t used_ssrc : sp.ssrcs) | 998 for (uint32_t used_ssrc : sp.ssrcs) |
994 send_ssrcs_.insert(used_ssrc); | 999 send_ssrcs_.insert(used_ssrc); |
995 | 1000 |
996 webrtc::VideoSendStream::Config config(this); | 1001 webrtc::VideoSendStream::Config config(this); |
997 config.overuse_callback = this; | |
998 | |
999 WebRtcVideoSendStream* stream = new WebRtcVideoSendStream( | 1002 WebRtcVideoSendStream* stream = new WebRtcVideoSendStream( |
1000 call_, sp, config, external_encoder_factory_, options_, | 1003 call_, sp, config, external_encoder_factory_, options_, |
1001 bitrate_config_.max_bitrate_bps, send_codec_, send_rtp_extensions_, | 1004 signal_cpu_adaptation_, bitrate_config_.max_bitrate_bps, send_codec_, |
1002 send_params_); | 1005 send_rtp_extensions_, send_params_); |
1003 | |
1004 uint32_t ssrc = sp.first_ssrc(); | 1006 uint32_t ssrc = sp.first_ssrc(); |
1005 RTC_DCHECK(ssrc != 0); | 1007 RTC_DCHECK(ssrc != 0); |
1006 send_streams_[ssrc] = stream; | 1008 send_streams_[ssrc] = stream; |
1007 | 1009 |
1008 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { | 1010 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { |
1009 rtcp_receiver_report_ssrc_ = ssrc; | 1011 rtcp_receiver_report_ssrc_ = ssrc; |
1010 LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added " | 1012 LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added " |
1011 "a send stream."; | 1013 "a send stream."; |
1012 for (auto& kv : receive_streams_) | 1014 for (auto& kv : receive_streams_) |
1013 kv.second->SetLocalSsrc(ssrc); | 1015 kv.second->SetLocalSsrc(ssrc); |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 | 1393 |
1392 // Speculative change to increase the outbound socket buffer size. | 1394 // Speculative change to increase the outbound socket buffer size. |
1393 // In b/15152257, we are seeing a significant number of packets discarded | 1395 // In b/15152257, we are seeing a significant number of packets discarded |
1394 // due to lack of socket buffer space, although it's not yet clear what the | 1396 // due to lack of socket buffer space, although it's not yet clear what the |
1395 // ideal value should be. | 1397 // ideal value should be. |
1396 MediaChannel::SetOption(NetworkInterface::ST_RTP, | 1398 MediaChannel::SetOption(NetworkInterface::ST_RTP, |
1397 rtc::Socket::OPT_SNDBUF, | 1399 rtc::Socket::OPT_SNDBUF, |
1398 kVideoRtpBufferSize); | 1400 kVideoRtpBufferSize); |
1399 } | 1401 } |
1400 | 1402 |
1401 void WebRtcVideoChannel2::OnLoadUpdate(Load load) { | |
1402 // OnLoadUpdate can not take any locks that are held while creating streams | |
1403 // etc. Doing so establishes lock-order inversions between the webrtc process | |
1404 // thread on stream creation and locks such as stream_crit_ while calling out. | |
1405 rtc::CritScope stream_lock(&capturer_crit_); | |
1406 if (!signal_cpu_adaptation_) | |
1407 return; | |
1408 // Do not adapt resolution for screen content as this will likely result in | |
1409 // blurry and unreadable text. | |
1410 for (auto& kv : capturers_) { | |
1411 if (kv.second != nullptr | |
1412 && !kv.second->IsScreencast() | |
1413 && kv.second->video_adapter() != nullptr) { | |
1414 kv.second->video_adapter()->OnCpuResolutionRequest( | |
1415 load == kOveruse ? CoordinatedVideoAdapter::DOWNGRADE | |
1416 : CoordinatedVideoAdapter::UPGRADE); | |
1417 } | |
1418 } | |
1419 } | |
1420 | |
1421 bool WebRtcVideoChannel2::SendRtp(const uint8_t* data, | 1403 bool WebRtcVideoChannel2::SendRtp(const uint8_t* data, |
1422 size_t len, | 1404 size_t len, |
1423 const webrtc::PacketOptions& options) { | 1405 const webrtc::PacketOptions& options) { |
1424 rtc::Buffer packet(data, len, kMaxRtpPacketLen); | 1406 rtc::Buffer packet(data, len, kMaxRtpPacketLen); |
1425 rtc::PacketOptions rtc_options; | 1407 rtc::PacketOptions rtc_options; |
1426 rtc_options.packet_id = options.packet_id; | 1408 rtc_options.packet_id = options.packet_id; |
1427 return MediaChannel::SendPacket(&packet, rtc_options); | 1409 return MediaChannel::SendPacket(&packet, rtc_options); |
1428 } | 1410 } |
1429 | 1411 |
1430 bool WebRtcVideoChannel2::SendRtcp(const uint8_t* data, size_t len) { | 1412 bool WebRtcVideoChannel2::SendRtcp(const uint8_t* data, size_t len) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 external_encoder(nullptr), | 1451 external_encoder(nullptr), |
1470 type(type), | 1452 type(type), |
1471 external(external) { | 1453 external(external) { |
1472 if (external) { | 1454 if (external) { |
1473 external_encoder = encoder; | 1455 external_encoder = encoder; |
1474 this->encoder = | 1456 this->encoder = |
1475 new webrtc::VideoEncoderSoftwareFallbackWrapper(type, encoder); | 1457 new webrtc::VideoEncoderSoftwareFallbackWrapper(type, encoder); |
1476 } | 1458 } |
1477 } | 1459 } |
1478 | 1460 |
| 1461 // Proxy class used for marshalling calls to webrtc::LoadObserver::OnLoadUpdate |
| 1462 // from a media engine thread to the worker thread. |
| 1463 class WebRtcVideoChannel2::WebRtcVideoSendStream::LoadObserverProxy { |
| 1464 public: |
| 1465 explicit LoadObserverProxy(webrtc::LoadObserver* observer) { |
| 1466 helper_ = new rtc::RefCountedObject<Helper>(observer); |
| 1467 } |
| 1468 ~LoadObserverProxy() { helper_->Detach(); } |
| 1469 |
| 1470 webrtc::LoadObserver* proxy() { return helper_; } |
| 1471 |
| 1472 private: |
| 1473 class Helper : public webrtc::LoadObserver, public rtc::RefCountInterface { |
| 1474 public: |
| 1475 explicit Helper(webrtc::LoadObserver* observer) |
| 1476 : thread_(rtc::Thread::Current()), observer_(observer) {} |
| 1477 void Detach() { |
| 1478 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 1479 observer_ = nullptr; |
| 1480 } |
| 1481 void OnLoadUpdate(webrtc::LoadObserver::Load load) override { |
| 1482 if (rtc::Thread::Current() == thread_) { |
| 1483 observer_->OnLoadUpdate(load); |
| 1484 return; |
| 1485 } |
| 1486 invoker_.AsyncInvoke<void>( |
| 1487 thread_, rtc::Bind(&Helper::OnLoadUpdateOnCorrectThread, this, load)); |
| 1488 } |
| 1489 void OnLoadUpdateOnCorrectThread(webrtc::LoadObserver::Load load) { |
| 1490 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 1491 if (observer_) { |
| 1492 observer_->OnLoadUpdate(load); |
| 1493 } |
| 1494 } |
| 1495 |
| 1496 private: |
| 1497 rtc::ThreadChecker thread_checker_; |
| 1498 rtc::AsyncInvoker invoker_; |
| 1499 rtc::Thread* thread_; |
| 1500 webrtc::LoadObserver* observer_; |
| 1501 }; |
| 1502 |
| 1503 rtc::scoped_refptr<Helper> helper_; |
| 1504 }; |
| 1505 |
1479 WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream( | 1506 WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream( |
1480 webrtc::Call* call, | 1507 webrtc::Call* call, |
1481 const StreamParams& sp, | 1508 const StreamParams& sp, |
1482 const webrtc::VideoSendStream::Config& config, | 1509 const webrtc::VideoSendStream::Config& config, |
1483 WebRtcVideoEncoderFactory* external_encoder_factory, | 1510 WebRtcVideoEncoderFactory* external_encoder_factory, |
1484 const VideoOptions& options, | 1511 const VideoOptions& options, |
| 1512 bool enable_cpu_overuse_detection, |
1485 int max_bitrate_bps, | 1513 int max_bitrate_bps, |
1486 const rtc::Optional<VideoCodecSettings>& codec_settings, | 1514 const rtc::Optional<VideoCodecSettings>& codec_settings, |
1487 const std::vector<webrtc::RtpExtension>& rtp_extensions, | 1515 const std::vector<webrtc::RtpExtension>& rtp_extensions, |
1488 // TODO(deadbeef): Don't duplicate information between send_params, | 1516 // TODO(deadbeef): Don't duplicate information between send_params, |
1489 // rtp_extensions, options, etc. | 1517 // rtp_extensions, options, etc. |
1490 const VideoSendParameters& send_params) | 1518 const VideoSendParameters& send_params) |
1491 : ssrcs_(sp.ssrcs), | 1519 : ssrcs_(sp.ssrcs), |
1492 ssrc_groups_(sp.ssrc_groups), | 1520 ssrc_groups_(sp.ssrc_groups), |
1493 call_(call), | 1521 call_(call), |
| 1522 load_proxy_(new LoadObserverProxy(this)), |
1494 external_encoder_factory_(external_encoder_factory), | 1523 external_encoder_factory_(external_encoder_factory), |
1495 stream_(NULL), | 1524 stream_(NULL), |
1496 parameters_(config, options, max_bitrate_bps, codec_settings), | 1525 parameters_(config, options, max_bitrate_bps, codec_settings), |
1497 pending_encoder_reconfiguration_(false), | 1526 pending_encoder_reconfiguration_(false), |
1498 allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false), | 1527 allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false), |
1499 capturer_(NULL), | 1528 capturer_(NULL), |
1500 sending_(false), | 1529 sending_(false), |
1501 muted_(false), | 1530 muted_(false), |
1502 old_adapt_changes_(0), | 1531 old_adapt_changes_(0), |
1503 first_frame_timestamp_ms_(0), | 1532 first_frame_timestamp_ms_(0), |
1504 last_frame_timestamp_ms_(0) { | 1533 last_frame_timestamp_ms_(0) { |
1505 parameters_.config.rtp.max_packet_size = kVideoMtu; | 1534 parameters_.config.rtp.max_packet_size = kVideoMtu; |
1506 | 1535 |
1507 sp.GetPrimarySsrcs(¶meters_.config.rtp.ssrcs); | 1536 sp.GetPrimarySsrcs(¶meters_.config.rtp.ssrcs); |
1508 sp.GetFidSsrcs(parameters_.config.rtp.ssrcs, | 1537 sp.GetFidSsrcs(parameters_.config.rtp.ssrcs, |
1509 ¶meters_.config.rtp.rtx.ssrcs); | 1538 ¶meters_.config.rtp.rtx.ssrcs); |
1510 parameters_.config.rtp.c_name = sp.cname; | 1539 parameters_.config.rtp.c_name = sp.cname; |
1511 parameters_.config.rtp.extensions = rtp_extensions; | 1540 parameters_.config.rtp.extensions = rtp_extensions; |
1512 parameters_.config.rtp.rtcp_mode = send_params.rtcp.reduced_size | 1541 parameters_.config.rtp.rtcp_mode = send_params.rtcp.reduced_size |
1513 ? webrtc::RtcpMode::kReducedSize | 1542 ? webrtc::RtcpMode::kReducedSize |
1514 : webrtc::RtcpMode::kCompound; | 1543 : webrtc::RtcpMode::kCompound; |
| 1544 parameters_.config.overuse_callback = |
| 1545 enable_cpu_overuse_detection ? load_proxy_->proxy() : nullptr; |
1515 | 1546 |
1516 if (codec_settings) { | 1547 if (codec_settings) { |
1517 SetCodecAndOptions(*codec_settings, parameters_.options); | 1548 SetCodecAndOptions(*codec_settings, parameters_.options); |
1518 } | 1549 } |
1519 } | 1550 } |
1520 | 1551 |
1521 WebRtcVideoChannel2::WebRtcVideoSendStream::~WebRtcVideoSendStream() { | 1552 WebRtcVideoChannel2::WebRtcVideoSendStream::~WebRtcVideoSendStream() { |
1522 DisconnectCapturer(); | 1553 DisconnectCapturer(); |
1523 if (stream_ != NULL) { | 1554 if (stream_ != NULL) { |
1524 call_->DestroyVideoSendStream(stream_); | 1555 call_->DestroyVideoSendStream(stream_); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1628 muted_ = mute; | 1659 muted_ = mute; |
1629 } | 1660 } |
1630 | 1661 |
1631 bool WebRtcVideoChannel2::WebRtcVideoSendStream::DisconnectCapturer() { | 1662 bool WebRtcVideoChannel2::WebRtcVideoSendStream::DisconnectCapturer() { |
1632 cricket::VideoCapturer* capturer; | 1663 cricket::VideoCapturer* capturer; |
1633 { | 1664 { |
1634 rtc::CritScope cs(&lock_); | 1665 rtc::CritScope cs(&lock_); |
1635 if (capturer_ == NULL) | 1666 if (capturer_ == NULL) |
1636 return false; | 1667 return false; |
1637 | 1668 |
1638 if (capturer_->video_adapter() != nullptr) | |
1639 old_adapt_changes_ += capturer_->video_adapter()->adaptation_changes(); | |
1640 | |
1641 capturer = capturer_; | 1669 capturer = capturer_; |
1642 capturer_ = NULL; | 1670 capturer_ = NULL; |
1643 } | 1671 } |
1644 capturer->RemoveSink(this); | 1672 capturer->RemoveSink(this); |
1645 | 1673 |
1646 return true; | 1674 return true; |
1647 } | 1675 } |
1648 | 1676 |
1649 const std::vector<uint32_t>& | 1677 const std::vector<uint32_t>& |
1650 WebRtcVideoChannel2::WebRtcVideoSendStream::GetSsrcs() const { | 1678 WebRtcVideoChannel2::WebRtcVideoSendStream::GetSsrcs() const { |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1922 } | 1950 } |
1923 | 1951 |
1924 void WebRtcVideoChannel2::WebRtcVideoSendStream::Stop() { | 1952 void WebRtcVideoChannel2::WebRtcVideoSendStream::Stop() { |
1925 rtc::CritScope cs(&lock_); | 1953 rtc::CritScope cs(&lock_); |
1926 if (stream_ != NULL) { | 1954 if (stream_ != NULL) { |
1927 stream_->Stop(); | 1955 stream_->Stop(); |
1928 } | 1956 } |
1929 sending_ = false; | 1957 sending_ = false; |
1930 } | 1958 } |
1931 | 1959 |
| 1960 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnLoadUpdate(Load load) { |
| 1961 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 1962 LOG(LS_INFO) << "OnLoadUpdate " << load; |
| 1963 rtc::CritScope cs(&lock_); |
| 1964 if (!capturer_) { |
| 1965 return; |
| 1966 } |
| 1967 |
| 1968 if (load == kOveruse) { |
| 1969 if (cpu_downscale_ < kMaxCpuDownScale) { |
| 1970 cpu_downscale_ *= 2; |
| 1971 sink_wants_.max_number_of_pixels = rtc::Optional<int>( |
| 1972 (last_dimensions_.height * last_dimensions_.width) / 2); |
| 1973 } |
| 1974 } else { |
| 1975 if (cpu_downscale_ > 1) { |
| 1976 cpu_downscale_ /= 2; |
| 1977 sink_wants_.max_number_of_pixels = rtc::Optional<int>( |
| 1978 (last_dimensions_.height * last_dimensions_.width) * 2); |
| 1979 } |
| 1980 } |
| 1981 capturer_->AddOrUpdateSink(this, sink_wants_); |
| 1982 } |
| 1983 |
1932 VideoSenderInfo | 1984 VideoSenderInfo |
1933 WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo() { | 1985 WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo() { |
1934 VideoSenderInfo info; | 1986 VideoSenderInfo info; |
1935 webrtc::VideoSendStream::Stats stats; | 1987 webrtc::VideoSendStream::Stats stats; |
1936 { | 1988 { |
1937 rtc::CritScope cs(&lock_); | 1989 rtc::CritScope cs(&lock_); |
1938 for (uint32_t ssrc : parameters_.config.rtp.ssrcs) | 1990 for (uint32_t ssrc : parameters_.config.rtp.ssrcs) |
1939 info.add_ssrc(ssrc); | 1991 info.add_ssrc(ssrc); |
1940 | 1992 |
1941 if (parameters_.codec_settings) | 1993 if (parameters_.codec_settings) |
(...skipping 18 matching lines...) Expand all Loading... |
1960 | 2012 |
1961 if (capturer_ != NULL) { | 2013 if (capturer_ != NULL) { |
1962 if (!capturer_->IsMuted()) { | 2014 if (!capturer_->IsMuted()) { |
1963 VideoFormat last_captured_frame_format; | 2015 VideoFormat last_captured_frame_format; |
1964 capturer_->GetStats(&info.adapt_frame_drops, &info.effects_frame_drops, | 2016 capturer_->GetStats(&info.adapt_frame_drops, &info.effects_frame_drops, |
1965 &info.capturer_frame_time, | 2017 &info.capturer_frame_time, |
1966 &last_captured_frame_format); | 2018 &last_captured_frame_format); |
1967 info.input_frame_width = last_captured_frame_format.width; | 2019 info.input_frame_width = last_captured_frame_format.width; |
1968 info.input_frame_height = last_captured_frame_format.height; | 2020 info.input_frame_height = last_captured_frame_format.height; |
1969 } | 2021 } |
1970 if (capturer_->video_adapter() != nullptr) { | |
1971 info.adapt_changes += capturer_->video_adapter()->adaptation_changes(); | |
1972 info.adapt_reason = capturer_->video_adapter()->adapt_reason(); | |
1973 } | |
1974 } | 2022 } |
1975 } | 2023 } |
1976 | 2024 |
1977 // Get bandwidth limitation info from stream_->GetStats(). | 2025 // Get bandwidth limitation info from stream_->GetStats(). |
1978 // Input resolution (output from video_adapter) can be further scaled down or | 2026 // Input resolution (output from video_adapter) can be further scaled down or |
1979 // higher video layer(s) can be dropped due to bitrate constraints. | 2027 // higher video layer(s) can be dropped due to bitrate constraints. |
1980 // Note, adapt_changes only include changes from the video_adapter. | 2028 // Note, adapt_changes only include changes from the video_adapter. |
1981 if (stats.bw_limited_resolution) | 2029 if (stats.bw_limited_resolution) |
1982 info.adapt_reason |= CoordinatedVideoAdapter::ADAPTREASON_BANDWIDTH; | 2030 info.adapt_reason |= CoordinatedVideoAdapter::ADAPTREASON_BANDWIDTH; |
1983 | 2031 |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2483 rtx_mapping[video_codecs[i].codec.id] != | 2531 rtx_mapping[video_codecs[i].codec.id] != |
2484 fec_settings.red_payload_type) { | 2532 fec_settings.red_payload_type) { |
2485 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2533 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2486 } | 2534 } |
2487 } | 2535 } |
2488 | 2536 |
2489 return video_codecs; | 2537 return video_codecs; |
2490 } | 2538 } |
2491 | 2539 |
2492 } // namespace cricket | 2540 } // namespace cricket |
OLD | NEW |