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 static const int kMaxCpuDowngrades = 2; // Downgrade at most 2 times for CPU. | |
338 | |
335 std::vector<VideoCodec> DefaultVideoCodecList() { | 339 std::vector<VideoCodec> DefaultVideoCodecList() { |
336 std::vector<VideoCodec> codecs; | 340 std::vector<VideoCodec> codecs; |
337 codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultVp8PlType, | 341 codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultVp8PlType, |
338 kVp8CodecName)); | 342 kVp8CodecName)); |
339 codecs.push_back( | 343 codecs.push_back( |
340 VideoCodec::CreateRtxCodec(kDefaultRtxVp8PlType, kDefaultVp8PlType)); | 344 VideoCodec::CreateRtxCodec(kDefaultRtxVp8PlType, kDefaultVp8PlType)); |
341 if (CodecIsInternallySupported(kVp9CodecName)) { | 345 if (CodecIsInternallySupported(kVp9CodecName)) { |
342 codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultVp9PlType, | 346 codecs.push_back(MakeVideoCodecWithDefaultFeedbackParams(kDefaultVp9PlType, |
343 kVp9CodecName)); | 347 kVp9CodecName)); |
344 codecs.push_back( | 348 codecs.push_back( |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
987 | 991 |
988 rtc::CritScope stream_lock(&stream_crit_); | 992 rtc::CritScope stream_lock(&stream_crit_); |
989 | 993 |
990 if (!ValidateSendSsrcAvailability(sp)) | 994 if (!ValidateSendSsrcAvailability(sp)) |
991 return false; | 995 return false; |
992 | 996 |
993 for (uint32_t used_ssrc : sp.ssrcs) | 997 for (uint32_t used_ssrc : sp.ssrcs) |
994 send_ssrcs_.insert(used_ssrc); | 998 send_ssrcs_.insert(used_ssrc); |
995 | 999 |
996 webrtc::VideoSendStream::Config config(this); | 1000 webrtc::VideoSendStream::Config config(this); |
997 config.overuse_callback = this; | |
998 | |
999 WebRtcVideoSendStream* stream = new WebRtcVideoSendStream( | 1001 WebRtcVideoSendStream* stream = new WebRtcVideoSendStream( |
1000 call_, sp, config, external_encoder_factory_, options_, | 1002 call_, sp, config, external_encoder_factory_, options_, |
1001 bitrate_config_.max_bitrate_bps, send_codec_, send_rtp_extensions_, | 1003 signal_cpu_adaptation_, bitrate_config_.max_bitrate_bps, send_codec_, |
1002 send_params_); | 1004 send_rtp_extensions_, send_params_); |
1003 | |
1004 uint32_t ssrc = sp.first_ssrc(); | 1005 uint32_t ssrc = sp.first_ssrc(); |
1005 RTC_DCHECK(ssrc != 0); | 1006 RTC_DCHECK(ssrc != 0); |
1006 send_streams_[ssrc] = stream; | 1007 send_streams_[ssrc] = stream; |
1007 | 1008 |
1008 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { | 1009 if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) { |
1009 rtcp_receiver_report_ssrc_ = ssrc; | 1010 rtcp_receiver_report_ssrc_ = ssrc; |
1010 LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added " | 1011 LOG(LS_INFO) << "SetLocalSsrc on all the receive streams because we added " |
1011 "a send stream."; | 1012 "a send stream."; |
1012 for (auto& kv : receive_streams_) | 1013 for (auto& kv : receive_streams_) |
1013 kv.second->SetLocalSsrc(ssrc); | 1014 kv.second->SetLocalSsrc(ssrc); |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1391 | 1392 |
1392 // Speculative change to increase the outbound socket buffer size. | 1393 // Speculative change to increase the outbound socket buffer size. |
1393 // In b/15152257, we are seeing a significant number of packets discarded | 1394 // 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 | 1395 // due to lack of socket buffer space, although it's not yet clear what the |
1395 // ideal value should be. | 1396 // ideal value should be. |
1396 MediaChannel::SetOption(NetworkInterface::ST_RTP, | 1397 MediaChannel::SetOption(NetworkInterface::ST_RTP, |
1397 rtc::Socket::OPT_SNDBUF, | 1398 rtc::Socket::OPT_SNDBUF, |
1398 kVideoRtpBufferSize); | 1399 kVideoRtpBufferSize); |
1399 } | 1400 } |
1400 | 1401 |
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, | 1402 bool WebRtcVideoChannel2::SendRtp(const uint8_t* data, |
1422 size_t len, | 1403 size_t len, |
1423 const webrtc::PacketOptions& options) { | 1404 const webrtc::PacketOptions& options) { |
1424 rtc::Buffer packet(data, len, kMaxRtpPacketLen); | 1405 rtc::Buffer packet(data, len, kMaxRtpPacketLen); |
1425 rtc::PacketOptions rtc_options; | 1406 rtc::PacketOptions rtc_options; |
1426 rtc_options.packet_id = options.packet_id; | 1407 rtc_options.packet_id = options.packet_id; |
1427 return MediaChannel::SendPacket(&packet, rtc_options); | 1408 return MediaChannel::SendPacket(&packet, rtc_options); |
1428 } | 1409 } |
1429 | 1410 |
1430 bool WebRtcVideoChannel2::SendRtcp(const uint8_t* data, size_t len) { | 1411 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), | 1450 external_encoder(nullptr), |
1470 type(type), | 1451 type(type), |
1471 external(external) { | 1452 external(external) { |
1472 if (external) { | 1453 if (external) { |
1473 external_encoder = encoder; | 1454 external_encoder = encoder; |
1474 this->encoder = | 1455 this->encoder = |
1475 new webrtc::VideoEncoderSoftwareFallbackWrapper(type, encoder); | 1456 new webrtc::VideoEncoderSoftwareFallbackWrapper(type, encoder); |
1476 } | 1457 } |
1477 } | 1458 } |
1478 | 1459 |
1460 class WebRtcVideoChannel2::WebRtcVideoSendStream::LoadObserverProxy { | |
1461 public: | |
1462 explicit LoadObserverProxy(webrtc::LoadObserver* observer) { | |
1463 helper_ = new rtc::RefCountedObject<Helper>(observer); | |
1464 } | |
1465 ~LoadObserverProxy() { helper_->Detach(); } | |
1466 | |
1467 webrtc::LoadObserver* proxy() { return helper_; } | |
1468 | |
1469 private: | |
1470 class Helper : public webrtc::LoadObserver, public rtc::RefCountInterface { | |
1471 public: | |
1472 explicit Helper(webrtc::LoadObserver* observer) | |
1473 : thread_(rtc::Thread::Current()), observer_(observer) {} | |
1474 void Detach() { | |
1475 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | |
1476 observer_ = nullptr; | |
1477 } | |
1478 void OnLoadUpdate(webrtc::LoadObserver::Load load) override { | |
1479 if (rtc::Thread::Current() == thread_) { | |
1480 observer_->OnLoadUpdate(load); | |
1481 return; | |
1482 } | |
1483 invoker_.AsyncInvoke<void>( | |
1484 thread_, rtc::Bind(&Helper::OnLoadUpdateOnCorrectThread, this, load)); | |
1485 } | |
1486 void OnLoadUpdateOnCorrectThread(webrtc::LoadObserver::Load load) { | |
1487 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | |
1488 if (observer_) { | |
1489 observer_->OnLoadUpdate(load); | |
1490 } | |
1491 } | |
1492 | |
1493 private: | |
1494 rtc::ThreadChecker thread_checker_; | |
1495 rtc::AsyncInvoker invoker_; | |
1496 rtc::Thread* thread_; | |
1497 webrtc::LoadObserver* observer_; | |
1498 }; | |
1499 | |
1500 rtc::scoped_refptr<Helper> helper_; | |
1501 }; | |
1502 | |
pthatcher1
2016/02/17 23:05:56
Can you explain why this proxy is necessary?
perkj_webrtc
2016/02/18 13:22:46
OnLoad is called on a media engine thread. Not the
pthatcher1
2016/02/19 06:08:39
It seems like a lot of complexity to add.
And I t
perkj_webrtc
2016/02/19 14:57:52
I agreee with OnFrame as said before.
I don't s
| |
1479 WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream( | 1503 WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream( |
1480 webrtc::Call* call, | 1504 webrtc::Call* call, |
1481 const StreamParams& sp, | 1505 const StreamParams& sp, |
1482 const webrtc::VideoSendStream::Config& config, | 1506 const webrtc::VideoSendStream::Config& config, |
1483 WebRtcVideoEncoderFactory* external_encoder_factory, | 1507 WebRtcVideoEncoderFactory* external_encoder_factory, |
1484 const VideoOptions& options, | 1508 const VideoOptions& options, |
1509 bool enable_cpu_overuse_detection, | |
1485 int max_bitrate_bps, | 1510 int max_bitrate_bps, |
1486 const rtc::Optional<VideoCodecSettings>& codec_settings, | 1511 const rtc::Optional<VideoCodecSettings>& codec_settings, |
1487 const std::vector<webrtc::RtpExtension>& rtp_extensions, | 1512 const std::vector<webrtc::RtpExtension>& rtp_extensions, |
1488 // TODO(deadbeef): Don't duplicate information between send_params, | 1513 // TODO(deadbeef): Don't duplicate information between send_params, |
1489 // rtp_extensions, options, etc. | 1514 // rtp_extensions, options, etc. |
1490 const VideoSendParameters& send_params) | 1515 const VideoSendParameters& send_params) |
1491 : ssrcs_(sp.ssrcs), | 1516 : ssrcs_(sp.ssrcs), |
1492 ssrc_groups_(sp.ssrc_groups), | 1517 ssrc_groups_(sp.ssrc_groups), |
1493 call_(call), | 1518 call_(call), |
1519 load_proxy_(new LoadObserverProxy(this)), | |
1494 external_encoder_factory_(external_encoder_factory), | 1520 external_encoder_factory_(external_encoder_factory), |
1495 stream_(NULL), | 1521 stream_(NULL), |
1496 parameters_(config, options, max_bitrate_bps, codec_settings), | 1522 parameters_(config, options, max_bitrate_bps, codec_settings), |
1497 pending_encoder_reconfiguration_(false), | 1523 pending_encoder_reconfiguration_(false), |
1498 allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false), | 1524 allocated_encoder_(NULL, webrtc::kVideoCodecUnknown, false), |
1499 capturer_(NULL), | 1525 capturer_(NULL), |
1500 sending_(false), | 1526 sending_(false), |
1501 muted_(false), | 1527 muted_(false), |
1502 old_adapt_changes_(0), | 1528 old_adapt_changes_(0), |
1503 first_frame_timestamp_ms_(0), | 1529 first_frame_timestamp_ms_(0), |
1504 last_frame_timestamp_ms_(0) { | 1530 last_frame_timestamp_ms_(0) { |
1505 parameters_.config.rtp.max_packet_size = kVideoMtu; | 1531 parameters_.config.rtp.max_packet_size = kVideoMtu; |
1506 | 1532 |
1507 sp.GetPrimarySsrcs(¶meters_.config.rtp.ssrcs); | 1533 sp.GetPrimarySsrcs(¶meters_.config.rtp.ssrcs); |
1508 sp.GetFidSsrcs(parameters_.config.rtp.ssrcs, | 1534 sp.GetFidSsrcs(parameters_.config.rtp.ssrcs, |
1509 ¶meters_.config.rtp.rtx.ssrcs); | 1535 ¶meters_.config.rtp.rtx.ssrcs); |
1510 parameters_.config.rtp.c_name = sp.cname; | 1536 parameters_.config.rtp.c_name = sp.cname; |
1511 parameters_.config.rtp.extensions = rtp_extensions; | 1537 parameters_.config.rtp.extensions = rtp_extensions; |
1512 parameters_.config.rtp.rtcp_mode = send_params.rtcp.reduced_size | 1538 parameters_.config.rtp.rtcp_mode = send_params.rtcp.reduced_size |
1513 ? webrtc::RtcpMode::kReducedSize | 1539 ? webrtc::RtcpMode::kReducedSize |
1514 : webrtc::RtcpMode::kCompound; | 1540 : webrtc::RtcpMode::kCompound; |
1541 parameters_.config.overuse_callback = | |
1542 enable_cpu_overuse_detection ? load_proxy_->proxy() : nullptr; | |
1515 | 1543 |
1516 if (codec_settings) { | 1544 if (codec_settings) { |
1517 SetCodecAndOptions(*codec_settings, parameters_.options); | 1545 SetCodecAndOptions(*codec_settings, parameters_.options); |
1518 } | 1546 } |
1519 } | 1547 } |
1520 | 1548 |
1521 WebRtcVideoChannel2::WebRtcVideoSendStream::~WebRtcVideoSendStream() { | 1549 WebRtcVideoChannel2::WebRtcVideoSendStream::~WebRtcVideoSendStream() { |
1522 DisconnectCapturer(); | 1550 DisconnectCapturer(); |
1523 if (stream_ != NULL) { | 1551 if (stream_ != NULL) { |
1524 call_->DestroyVideoSendStream(stream_); | 1552 call_->DestroyVideoSendStream(stream_); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1628 muted_ = mute; | 1656 muted_ = mute; |
1629 } | 1657 } |
1630 | 1658 |
1631 bool WebRtcVideoChannel2::WebRtcVideoSendStream::DisconnectCapturer() { | 1659 bool WebRtcVideoChannel2::WebRtcVideoSendStream::DisconnectCapturer() { |
1632 cricket::VideoCapturer* capturer; | 1660 cricket::VideoCapturer* capturer; |
1633 { | 1661 { |
1634 rtc::CritScope cs(&lock_); | 1662 rtc::CritScope cs(&lock_); |
1635 if (capturer_ == NULL) | 1663 if (capturer_ == NULL) |
1636 return false; | 1664 return false; |
1637 | 1665 |
1638 if (capturer_->video_adapter() != nullptr) | |
1639 old_adapt_changes_ += capturer_->video_adapter()->adaptation_changes(); | |
1640 | |
1641 capturer = capturer_; | 1666 capturer = capturer_; |
1642 capturer_ = NULL; | 1667 capturer_ = NULL; |
1643 } | 1668 } |
1644 capturer->RemoveSink(this); | 1669 capturer->RemoveSink(this); |
1645 | 1670 |
1646 return true; | 1671 return true; |
1647 } | 1672 } |
1648 | 1673 |
1649 const std::vector<uint32_t>& | 1674 const std::vector<uint32_t>& |
1650 WebRtcVideoChannel2::WebRtcVideoSendStream::GetSsrcs() const { | 1675 WebRtcVideoChannel2::WebRtcVideoSendStream::GetSsrcs() const { |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1922 } | 1947 } |
1923 | 1948 |
1924 void WebRtcVideoChannel2::WebRtcVideoSendStream::Stop() { | 1949 void WebRtcVideoChannel2::WebRtcVideoSendStream::Stop() { |
1925 rtc::CritScope cs(&lock_); | 1950 rtc::CritScope cs(&lock_); |
1926 if (stream_ != NULL) { | 1951 if (stream_ != NULL) { |
1927 stream_->Stop(); | 1952 stream_->Stop(); |
1928 } | 1953 } |
1929 sending_ = false; | 1954 sending_ = false; |
1930 } | 1955 } |
1931 | 1956 |
1957 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnLoadUpdate(Load load) { | |
1958 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | |
1959 LOG(LS_INFO) << "OnLoadUpdate " << load; | |
1960 rtc::CritScope cs(&lock_); | |
1961 if (!capturer_) { | |
1962 return; | |
1963 } | |
1964 | |
1965 if (load == kOveruse) { | |
1966 if (cpu_downgrade_count_ < kMaxCpuDowngrades) { | |
1967 cpu_downgrade_count_++; | |
1968 sink_wants_.max_number_of_pixels = | |
1969 (last_dimensions_.height * last_dimensions_.width) / 2; | |
1970 } | |
1971 } else { | |
1972 if (cpu_downgrade_count_ > 0) { | |
1973 cpu_downgrade_count_--; | |
1974 sink_wants_.max_number_of_pixels = | |
1975 (last_dimensions_.height * last_dimensions_.width) * 2; | |
1976 } | |
pthatcher1
2016/02/17 23:05:56
This doesn't seem to work right for situations whe
perkj_webrtc
2016/02/18 13:22:46
Currently - CPU adaptation is not done for screen
perkj_webrtc
2016/02/18 14:30:54
So back to your example- pbos convinced me of your
| |
1977 } | |
1978 capturer_->AddOrUpdateSink(this, sink_wants_); | |
1979 } | |
1980 | |
1932 VideoSenderInfo | 1981 VideoSenderInfo |
1933 WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo() { | 1982 WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo() { |
1934 VideoSenderInfo info; | 1983 VideoSenderInfo info; |
1935 webrtc::VideoSendStream::Stats stats; | 1984 webrtc::VideoSendStream::Stats stats; |
1936 { | 1985 { |
1937 rtc::CritScope cs(&lock_); | 1986 rtc::CritScope cs(&lock_); |
1938 for (uint32_t ssrc : parameters_.config.rtp.ssrcs) | 1987 for (uint32_t ssrc : parameters_.config.rtp.ssrcs) |
1939 info.add_ssrc(ssrc); | 1988 info.add_ssrc(ssrc); |
1940 | 1989 |
1941 if (parameters_.codec_settings) | 1990 if (parameters_.codec_settings) |
(...skipping 18 matching lines...) Expand all Loading... | |
1960 | 2009 |
1961 if (capturer_ != NULL) { | 2010 if (capturer_ != NULL) { |
1962 if (!capturer_->IsMuted()) { | 2011 if (!capturer_->IsMuted()) { |
1963 VideoFormat last_captured_frame_format; | 2012 VideoFormat last_captured_frame_format; |
1964 capturer_->GetStats(&info.adapt_frame_drops, &info.effects_frame_drops, | 2013 capturer_->GetStats(&info.adapt_frame_drops, &info.effects_frame_drops, |
1965 &info.capturer_frame_time, | 2014 &info.capturer_frame_time, |
1966 &last_captured_frame_format); | 2015 &last_captured_frame_format); |
1967 info.input_frame_width = last_captured_frame_format.width; | 2016 info.input_frame_width = last_captured_frame_format.width; |
1968 info.input_frame_height = last_captured_frame_format.height; | 2017 info.input_frame_height = last_captured_frame_format.height; |
1969 } | 2018 } |
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 } | 2019 } |
1975 } | 2020 } |
1976 | 2021 |
1977 // Get bandwidth limitation info from stream_->GetStats(). | 2022 // Get bandwidth limitation info from stream_->GetStats(). |
1978 // Input resolution (output from video_adapter) can be further scaled down or | 2023 // Input resolution (output from video_adapter) can be further scaled down or |
1979 // higher video layer(s) can be dropped due to bitrate constraints. | 2024 // higher video layer(s) can be dropped due to bitrate constraints. |
1980 // Note, adapt_changes only include changes from the video_adapter. | 2025 // Note, adapt_changes only include changes from the video_adapter. |
1981 if (stats.bw_limited_resolution) | 2026 if (stats.bw_limited_resolution) |
1982 info.adapt_reason |= CoordinatedVideoAdapter::ADAPTREASON_BANDWIDTH; | 2027 info.adapt_reason |= CoordinatedVideoAdapter::ADAPTREASON_BANDWIDTH; |
1983 | 2028 |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2483 rtx_mapping[video_codecs[i].codec.id] != | 2528 rtx_mapping[video_codecs[i].codec.id] != |
2484 fec_settings.red_payload_type) { | 2529 fec_settings.red_payload_type) { |
2485 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2530 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2486 } | 2531 } |
2487 } | 2532 } |
2488 | 2533 |
2489 return video_codecs; | 2534 return video_codecs; |
2490 } | 2535 } |
2491 | 2536 |
2492 } // namespace cricket | 2537 } // namespace cricket |
OLD | NEW |