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

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

Issue 1766653002: Replace SetCapturer and SetCaptureDevice by SetSource. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Make SetSource tolerate unknown ssrc and source == NULL. Created 4 years, 9 months 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 <algorithm> 13 #include <algorithm>
14 #include <set> 14 #include <set>
15 #include <string> 15 #include <string>
16 16
17 #include "webrtc/base/buffer.h" 17 #include "webrtc/base/buffer.h"
18 #include "webrtc/base/logging.h" 18 #include "webrtc/base/logging.h"
19 #include "webrtc/base/stringutils.h" 19 #include "webrtc/base/stringutils.h"
20 #include "webrtc/base/timeutils.h" 20 #include "webrtc/base/timeutils.h"
21 #include "webrtc/base/trace_event.h" 21 #include "webrtc/base/trace_event.h"
22 #include "webrtc/call.h" 22 #include "webrtc/call.h"
23 #include "webrtc/media/base/videocapturer.h"
24 #include "webrtc/media/base/videorenderer.h"
25 #include "webrtc/media/engine/constants.h" 23 #include "webrtc/media/engine/constants.h"
26 #include "webrtc/media/engine/simulcast.h" 24 #include "webrtc/media/engine/simulcast.h"
27 #include "webrtc/media/engine/webrtcmediaengine.h" 25 #include "webrtc/media/engine/webrtcmediaengine.h"
28 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" 26 #include "webrtc/media/engine/webrtcvideoencoderfactory.h"
29 #include "webrtc/media/engine/webrtcvideoframe.h" 27 #include "webrtc/media/engine/webrtcvideoframe.h"
30 #include "webrtc/media/engine/webrtcvoiceengine.h" 28 #include "webrtc/media/engine/webrtcvoiceengine.h"
31 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" 29 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
32 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" 30 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h"
33 #include "webrtc/system_wrappers/include/field_trial.h" 31 #include "webrtc/system_wrappers/include/field_trial.h"
34 #include "webrtc/video_decoder.h" 32 #include "webrtc/video_decoder.h"
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 // Get send stream bitrate stats. 1258 // Get send stream bitrate stats.
1261 rtc::CritScope stream_lock(&stream_crit_); 1259 rtc::CritScope stream_lock(&stream_crit_);
1262 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator stream = 1260 for (std::map<uint32_t, WebRtcVideoSendStream*>::iterator stream =
1263 send_streams_.begin(); 1261 send_streams_.begin();
1264 stream != send_streams_.end(); ++stream) { 1262 stream != send_streams_.end(); ++stream) {
1265 stream->second->FillBandwidthEstimationInfo(&bwe_info); 1263 stream->second->FillBandwidthEstimationInfo(&bwe_info);
1266 } 1264 }
1267 video_media_info->bw_estimations.push_back(bwe_info); 1265 video_media_info->bw_estimations.push_back(bwe_info);
1268 } 1266 }
1269 1267
1270 bool WebRtcVideoChannel2::SetCapturer(uint32_t ssrc, VideoCapturer* capturer) { 1268 void WebRtcVideoChannel2::SetSource(
1271 LOG(LS_INFO) << "SetCapturer: " << ssrc << " -> " 1269 uint32_t ssrc,
1272 << (capturer != NULL ? "(capturer)" : "NULL"); 1270 rtc::VideoSourceInterface<cricket::VideoFrame>* source) {
1273 RTC_DCHECK(ssrc != 0); 1271 LOG(LS_INFO) << "SetSource: " << ssrc << " -> "
1274 { 1272 << (source ? "(source)" : "NULL");
1275 rtc::CritScope stream_lock(&stream_crit_); 1273 RTC_CHECK(ssrc != 0);
1276 const auto& kv = send_streams_.find(ssrc); 1274
1277 if (kv == send_streams_.end()) { 1275 rtc::CritScope stream_lock(&stream_crit_);
1278 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; 1276 const auto& kv = send_streams_.find(ssrc);
1279 return false; 1277 if (kv == send_streams_.end()) {
1280 } 1278 // Allow unknown ssrc only if source is null.
1281 if (!kv->second->SetCapturer(capturer)) { 1279 RTC_CHECK(source == nullptr);
1282 return false;
1283 }
1284 } 1280 }
1285 return true; 1281 else {
1282 send_streams_.find(ssrc)->second->SetSource(source);
pthatcher1 2016/03/05 01:45:41 Why not kv->second->SetSource(source)?
nisse-webrtc 2016/03/15 16:28:00 Done.
1283 }
1286 } 1284 }
1287 1285
1288 void WebRtcVideoChannel2::OnPacketReceived( 1286 void WebRtcVideoChannel2::OnPacketReceived(
1289 rtc::Buffer* packet, 1287 rtc::Buffer* packet,
1290 const rtc::PacketTime& packet_time) { 1288 const rtc::PacketTime& packet_time) {
1291 const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, 1289 const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp,
1292 packet_time.not_before); 1290 packet_time.not_before);
1293 const webrtc::PacketReceiver::DeliveryStatus delivery_result = 1291 const webrtc::PacketReceiver::DeliveryStatus delivery_result =
1294 call_->Receiver()->DeliverPacket( 1292 call_->Receiver()->DeliverPacket(
1295 webrtc::MediaType::VIDEO, 1293 webrtc::MediaType::VIDEO,
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 const std::vector<webrtc::RtpExtension>& rtp_extensions, 1474 const std::vector<webrtc::RtpExtension>& rtp_extensions,
1477 // TODO(deadbeef): Don't duplicate information between send_params, 1475 // TODO(deadbeef): Don't duplicate information between send_params,
1478 // rtp_extensions, options, etc. 1476 // rtp_extensions, options, etc.
1479 const VideoSendParameters& send_params) 1477 const VideoSendParameters& send_params)
1480 : worker_thread_(rtc::Thread::Current()), 1478 : worker_thread_(rtc::Thread::Current()),
1481 ssrcs_(sp.ssrcs), 1479 ssrcs_(sp.ssrcs),
1482 ssrc_groups_(sp.ssrc_groups), 1480 ssrc_groups_(sp.ssrc_groups),
1483 call_(call), 1481 call_(call),
1484 cpu_restricted_counter_(0), 1482 cpu_restricted_counter_(0),
1485 number_of_cpu_adapt_changes_(0), 1483 number_of_cpu_adapt_changes_(0),
1486 capturer_(nullptr), 1484 source_(nullptr),
1487 external_encoder_factory_(external_encoder_factory), 1485 external_encoder_factory_(external_encoder_factory),
1488 stream_(nullptr), 1486 stream_(nullptr),
1489 parameters_(config, send_params.options, max_bitrate_bps, codec_settings), 1487 parameters_(config, send_params.options, max_bitrate_bps, codec_settings),
1490 pending_encoder_reconfiguration_(false), 1488 pending_encoder_reconfiguration_(false),
1491 allocated_encoder_(nullptr, webrtc::kVideoCodecUnknown, false), 1489 allocated_encoder_(nullptr, webrtc::kVideoCodecUnknown, false),
1492 sending_(false), 1490 sending_(false),
1493 muted_(false), 1491 muted_(false),
1494 first_frame_timestamp_ms_(0), 1492 first_frame_timestamp_ms_(0),
1495 last_frame_timestamp_ms_(0) { 1493 last_frame_timestamp_ms_(0) {
1496 parameters_.config.rtp.max_packet_size = kVideoMtu; 1494 parameters_.config.rtp.max_packet_size = kVideoMtu;
(...skipping 12 matching lines...) Expand all
1509 1507
1510 sink_wants_.rotation_applied = !ContainsHeaderExtension( 1508 sink_wants_.rotation_applied = !ContainsHeaderExtension(
1511 rtp_extensions, kRtpVideoRotationHeaderExtension); 1509 rtp_extensions, kRtpVideoRotationHeaderExtension);
1512 1510
1513 if (codec_settings) { 1511 if (codec_settings) {
1514 SetCodec(*codec_settings); 1512 SetCodec(*codec_settings);
1515 } 1513 }
1516 } 1514 }
1517 1515
1518 WebRtcVideoChannel2::WebRtcVideoSendStream::~WebRtcVideoSendStream() { 1516 WebRtcVideoChannel2::WebRtcVideoSendStream::~WebRtcVideoSendStream() {
1519 DisconnectCapturer(); 1517 DisconnectSource();
1520 if (stream_ != NULL) { 1518 if (stream_ != NULL) {
1521 call_->DestroyVideoSendStream(stream_); 1519 call_->DestroyVideoSendStream(stream_);
1522 } 1520 }
1523 DestroyVideoEncoder(&allocated_encoder_); 1521 DestroyVideoEncoder(&allocated_encoder_);
1524 } 1522 }
1525 1523
1526 static void CreateBlackFrame(webrtc::VideoFrame* video_frame, 1524 static void CreateBlackFrame(webrtc::VideoFrame* video_frame,
1527 int width, 1525 int width,
1528 int height, 1526 int height,
1529 webrtc::VideoRotation rotation) { 1527 webrtc::VideoRotation rotation) {
(...skipping 17 matching lines...) Expand all
1547 if (stream_ == NULL) { 1545 if (stream_ == NULL) {
1548 // Frame input before send codecs are configured, dropping frame. 1546 // Frame input before send codecs are configured, dropping frame.
1549 return; 1547 return;
1550 } 1548 }
1551 1549
1552 // Not sending, abort early to prevent expensive reconfigurations while 1550 // Not sending, abort early to prevent expensive reconfigurations while
1553 // setting up codecs etc. 1551 // setting up codecs etc.
1554 if (!sending_) 1552 if (!sending_)
1555 return; 1553 return;
1556 1554
1555 // TODO(nisse): Keep?
pthatcher1 2016/03/05 01:45:41 Yes, we need to keep this. It's part of the stand
nisse-webrtc 2016/03/15 16:28:00 A while ago, I added similar logic in the VideoTra
pthatcher1 2016/03/15 16:56:45 Yes, I saw that CL while Per was here. If the Vid
1557 if (muted_) { 1556 if (muted_) {
1558 // Create a black frame to transmit instead. 1557 // Create a black frame to transmit instead.
1559 CreateBlackFrame(&video_frame, 1558 CreateBlackFrame(&video_frame,
1560 static_cast<int>(frame.GetWidth()), 1559 static_cast<int>(frame.GetWidth()),
1561 static_cast<int>(frame.GetHeight()), 1560 static_cast<int>(frame.GetHeight()),
1562 video_frame.rotation()); 1561 video_frame.rotation());
1563 } 1562 }
1564 1563
1565 int64_t frame_delta_ms = frame.GetTimeStamp() / rtc::kNumNanosecsPerMillisec; 1564 int64_t frame_delta_ms = frame.GetTimeStamp() / rtc::kNumNanosecsPerMillisec;
1566 // frame->GetTimeStamp() is essentially a delta, align to webrtc time 1565 // frame->GetTimeStamp() is essentially a delta, align to webrtc time
1567 if (first_frame_timestamp_ms_ == 0) { 1566 if (first_frame_timestamp_ms_ == 0) {
1568 first_frame_timestamp_ms_ = rtc::Time() - frame_delta_ms; 1567 first_frame_timestamp_ms_ = rtc::Time() - frame_delta_ms;
1569 } 1568 }
1570 1569
1571 last_frame_timestamp_ms_ = first_frame_timestamp_ms_ + frame_delta_ms; 1570 last_frame_timestamp_ms_ = first_frame_timestamp_ms_ + frame_delta_ms;
1572 video_frame.set_render_time_ms(last_frame_timestamp_ms_); 1571 video_frame.set_render_time_ms(last_frame_timestamp_ms_);
1573 // Reconfigure codec if necessary. 1572 // Reconfigure codec if necessary.
1574 SetDimensions(video_frame.width(), video_frame.height()); 1573 SetDimensions(video_frame.width(), video_frame.height());
1575 last_rotation_ = video_frame.rotation(); 1574 last_rotation_ = video_frame.rotation();
1576 1575
1577 stream_->Input()->IncomingCapturedFrame(video_frame); 1576 stream_->Input()->IncomingCapturedFrame(video_frame);
1578 } 1577 }
1579 1578
1580 bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetCapturer( 1579 void WebRtcVideoChannel2::WebRtcVideoSendStream::SetSource(
1581 VideoCapturer* capturer) { 1580 rtc::VideoSourceInterface<cricket::VideoFrame>* source) {
1582 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::SetCapturer"); 1581 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::SetSource");
1583 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 1582 RTC_DCHECK(thread_checker_.CalledOnValidThread());
1584 if (!DisconnectCapturer() && capturer == NULL) { 1583
1585 return false; 1584 if (!source && !source_)
1586 } 1585 return;
1586 DisconnectSource();
1587 1587
1588 { 1588 {
1589 rtc::CritScope cs(&lock_); 1589 rtc::CritScope cs(&lock_);
1590 1590
1591 // Reset timestamps to realign new incoming frames to a webrtc timestamp. A 1591 // Reset timestamps to realign new incoming frames to a webrtc timestamp. A
1592 // new capturer may have a different timestamp delta than the previous one. 1592 // new capturer may have a different timestamp delta than the previous one.
1593 first_frame_timestamp_ms_ = 0; 1593 first_frame_timestamp_ms_ = 0;
1594 1594
1595 if (capturer == NULL) { 1595 if (source == NULL) {
1596 if (stream_ != NULL) { 1596 if (stream_ != NULL) {
1597 LOG(LS_VERBOSE) << "Disabling capturer, sending black frame."; 1597 LOG(LS_VERBOSE) << "Disabling capturer, sending black frame.";
1598 webrtc::VideoFrame black_frame; 1598 webrtc::VideoFrame black_frame;
1599 1599
1600 CreateBlackFrame(&black_frame, last_dimensions_.width, 1600 CreateBlackFrame(&black_frame, last_dimensions_.width,
1601 last_dimensions_.height, last_rotation_); 1601 last_dimensions_.height, last_rotation_);
1602 1602
1603 // Force this black frame not to be dropped due to timestamp order 1603 // Force this black frame not to be dropped due to timestamp order
1604 // check. As IncomingCapturedFrame will drop the frame if this frame's 1604 // check. As IncomingCapturedFrame will drop the frame if this frame's
1605 // timestamp is less than or equal to last frame's timestamp, it is 1605 // timestamp is less than or equal to last frame's timestamp, it is
1606 // necessary to give this black frame a larger timestamp than the 1606 // necessary to give this black frame a larger timestamp than the
1607 // previous one. 1607 // previous one.
1608 last_frame_timestamp_ms_ += 1; 1608 last_frame_timestamp_ms_ += 1;
1609 black_frame.set_render_time_ms(last_frame_timestamp_ms_); 1609 black_frame.set_render_time_ms(last_frame_timestamp_ms_);
1610 stream_->Input()->IncomingCapturedFrame(black_frame); 1610 stream_->Input()->IncomingCapturedFrame(black_frame);
1611 } 1611 }
1612
1613 capturer_ = NULL;
1614 return true;
1615 } 1612 }
1616 } 1613 }
1617 capturer_ = capturer; 1614 source_ = source;
1618 capturer_->AddOrUpdateSink(this, sink_wants_); 1615 if (source_)
1619 return true; 1616 source_->AddOrUpdateSink(this, sink_wants_);
pthatcher1 2016/03/05 01:45:41 {} please
nisse-webrtc 2016/03/15 16:28:00 Done.
1620 } 1617 }
1621 1618
1622 void WebRtcVideoChannel2::WebRtcVideoSendStream::MuteStream(bool mute) { 1619 void WebRtcVideoChannel2::WebRtcVideoSendStream::MuteStream(bool mute) {
1623 rtc::CritScope cs(&lock_); 1620 rtc::CritScope cs(&lock_);
1624 muted_ = mute; 1621 muted_ = mute;
1625 } 1622 }
1626 1623
1627 bool WebRtcVideoChannel2::WebRtcVideoSendStream::DisconnectCapturer() { 1624 void WebRtcVideoChannel2::WebRtcVideoSendStream::DisconnectSource() {
1628 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 1625 RTC_DCHECK(thread_checker_.CalledOnValidThread());
1629 if (capturer_ == NULL) { 1626 if (source_ == NULL) {
1630 return false; 1627 return;
1631 } 1628 }
1632 1629
1633 capturer_->RemoveSink(this); 1630 source_->RemoveSink(this);
1634 capturer_ = NULL; 1631 source_ = NULL;
1635 // Reset |cpu_restricted_counter_| if the capturer is changed. It is not 1632 // Reset |cpu_restricted_counter_| if the capturer is changed. It is not
1636 // possible to know if the video resolution is restricted by CPU usage after 1633 // possible to know if the video resolution is restricted by CPU usage after
1637 // the capturer is changed since the next capturer might be screen capture 1634 // the capturer is changed since the next capturer might be screen capture
1638 // with another resolution and frame rate. 1635 // with another resolution and frame rate.
1639 cpu_restricted_counter_ = 0; 1636 cpu_restricted_counter_ = 0;
1640 return true;
1641 } 1637 }
1642 1638
1643 const std::vector<uint32_t>& 1639 const std::vector<uint32_t>&
1644 WebRtcVideoChannel2::WebRtcVideoSendStream::GetSsrcs() const { 1640 WebRtcVideoChannel2::WebRtcVideoSendStream::GetSsrcs() const {
1645 return ssrcs_; 1641 return ssrcs_;
1646 } 1642 }
1647 1643
1648 void WebRtcVideoChannel2::WebRtcVideoSendStream::SetOptions( 1644 void WebRtcVideoChannel2::WebRtcVideoSendStream::SetOptions(
1649 const VideoOptions& options) { 1645 const VideoOptions& options) {
1650 rtc::CritScope cs(&lock_); 1646 rtc::CritScope cs(&lock_);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 // sending stream needs to be reset with the new config. 1755 // sending stream needs to be reset with the new config.
1760 bool recreate_stream = false; 1756 bool recreate_stream = false;
1761 if (params.rtcp_mode) { 1757 if (params.rtcp_mode) {
1762 parameters_.config.rtp.rtcp_mode = *params.rtcp_mode; 1758 parameters_.config.rtp.rtcp_mode = *params.rtcp_mode;
1763 recreate_stream = true; 1759 recreate_stream = true;
1764 } 1760 }
1765 if (params.rtp_header_extensions) { 1761 if (params.rtp_header_extensions) {
1766 parameters_.config.rtp.extensions = *params.rtp_header_extensions; 1762 parameters_.config.rtp.extensions = *params.rtp_header_extensions;
1767 sink_wants_.rotation_applied = !ContainsHeaderExtension( 1763 sink_wants_.rotation_applied = !ContainsHeaderExtension(
1768 *params.rtp_header_extensions, kRtpVideoRotationHeaderExtension); 1764 *params.rtp_header_extensions, kRtpVideoRotationHeaderExtension);
1769 if (capturer_) { 1765 if (source_) {
1770 capturer_->AddOrUpdateSink(this, sink_wants_); 1766 source_->AddOrUpdateSink(this, sink_wants_);
1771 } 1767 }
1772 recreate_stream = true; 1768 recreate_stream = true;
1773 } 1769 }
1774 if (params.max_bandwidth_bps) { 1770 if (params.max_bandwidth_bps) {
1775 // Max bitrate has changed, reconfigure encoder settings on the next frame 1771 // Max bitrate has changed, reconfigure encoder settings on the next frame
1776 // or stream recreation. 1772 // or stream recreation.
1777 parameters_.max_bitrate_bps = *params.max_bandwidth_bps; 1773 parameters_.max_bitrate_bps = *params.max_bandwidth_bps;
1778 pending_encoder_reconfiguration_ = true; 1774 pending_encoder_reconfiguration_ = true;
1779 } 1775 }
1780 if (params.conference_mode) { 1776 if (params.conference_mode) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 1902
1907 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnLoadUpdate(Load load) { 1903 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnLoadUpdate(Load load) {
1908 if (worker_thread_ != rtc::Thread::Current()) { 1904 if (worker_thread_ != rtc::Thread::Current()) {
1909 invoker_.AsyncInvoke<void>( 1905 invoker_.AsyncInvoke<void>(
1910 worker_thread_, 1906 worker_thread_,
1911 rtc::Bind(&WebRtcVideoChannel2::WebRtcVideoSendStream::OnLoadUpdate, 1907 rtc::Bind(&WebRtcVideoChannel2::WebRtcVideoSendStream::OnLoadUpdate,
1912 this, load)); 1908 this, load));
1913 return; 1909 return;
1914 } 1910 }
1915 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 1911 RTC_DCHECK(thread_checker_.CalledOnValidThread());
1916 if (!capturer_) { 1912 if (!source_) {
1917 return; 1913 return;
1918 } 1914 }
1919 { 1915 {
1920 rtc::CritScope cs(&lock_); 1916 rtc::CritScope cs(&lock_);
1921 LOG(LS_INFO) << "OnLoadUpdate " << load << ", is_screencast: " 1917 LOG(LS_INFO) << "OnLoadUpdate " << load << ", is_screencast: "
1922 << (parameters_.options.is_screencast 1918 << (parameters_.options.is_screencast
1923 ? (*parameters_.options.is_screencast ? "true" 1919 ? (*parameters_.options.is_screencast ? "true"
1924 : "false") 1920 : "false")
1925 : "unset"); 1921 : "unset");
1926 // Do not adapt resolution for screen content as this will likely result in 1922 // Do not adapt resolution for screen content as this will likely result in
(...skipping 26 matching lines...) Expand all
1953 if (sink_wants_.max_pixel_count || 1949 if (sink_wants_.max_pixel_count ||
1954 (sink_wants_.max_pixel_count_step_up && 1950 (sink_wants_.max_pixel_count_step_up &&
1955 *sink_wants_.max_pixel_count_step_up < *max_pixel_count_step_up)) { 1951 *sink_wants_.max_pixel_count_step_up < *max_pixel_count_step_up)) {
1956 ++number_of_cpu_adapt_changes_; 1952 ++number_of_cpu_adapt_changes_;
1957 --cpu_restricted_counter_; 1953 --cpu_restricted_counter_;
1958 } 1954 }
1959 } 1955 }
1960 sink_wants_.max_pixel_count = max_pixel_count; 1956 sink_wants_.max_pixel_count = max_pixel_count;
1961 sink_wants_.max_pixel_count_step_up = max_pixel_count_step_up; 1957 sink_wants_.max_pixel_count_step_up = max_pixel_count_step_up;
1962 } 1958 }
1963 capturer_->AddOrUpdateSink(this, sink_wants_); 1959 source_->AddOrUpdateSink(this, sink_wants_);
1964 } 1960 }
1965 1961
1966 VideoSenderInfo 1962 VideoSenderInfo
1967 WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo() { 1963 WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo() {
1968 VideoSenderInfo info; 1964 VideoSenderInfo info;
1969 webrtc::VideoSendStream::Stats stats; 1965 webrtc::VideoSendStream::Stats stats;
1970 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 1966 RTC_DCHECK(thread_checker_.CalledOnValidThread());
1971 { 1967 {
1972 rtc::CritScope cs(&lock_); 1968 rtc::CritScope cs(&lock_);
1973 for (uint32_t ssrc : parameters_.config.rtp.ssrcs) 1969 for (uint32_t ssrc : parameters_.config.rtp.ssrcs)
(...skipping 14 matching lines...) Expand all
1988 if (stream_ == NULL) 1984 if (stream_ == NULL)
1989 return info; 1985 return info;
1990 1986
1991 stats = stream_->GetStats(); 1987 stats = stream_->GetStats();
1992 } 1988 }
1993 info.adapt_changes = number_of_cpu_adapt_changes_; 1989 info.adapt_changes = number_of_cpu_adapt_changes_;
1994 info.adapt_reason = cpu_restricted_counter_ <= 0 1990 info.adapt_reason = cpu_restricted_counter_ <= 0
1995 ? CoordinatedVideoAdapter::ADAPTREASON_NONE 1991 ? CoordinatedVideoAdapter::ADAPTREASON_NONE
1996 : CoordinatedVideoAdapter::ADAPTREASON_CPU; 1992 : CoordinatedVideoAdapter::ADAPTREASON_CPU;
1997 1993
1998 if (capturer_) { 1994 if (source_) {
1999 VideoFormat last_captured_frame_format; 1995 VideoFormat last_captured_frame_format;
1996 // TODO(nisse): Move stats logic elsewhere?
1997 #if 0
2000 capturer_->GetStats(&info.adapt_frame_drops, &info.effects_frame_drops, 1998 capturer_->GetStats(&info.adapt_frame_drops, &info.effects_frame_drops,
2001 &info.capturer_frame_time, 1999 &info.capturer_frame_time,
2002 &last_captured_frame_format); 2000 &last_captured_frame_format);
2001 #endif
pthatcher1 2016/03/05 01:45:41 What?
nisse-webrtc 2016/03/15 16:28:00 To get the cl in a landable state, we have to figu
pthatcher1 2016/03/15 16:56:45 adapt_frame_drops, effects_frame_drops, and captur
2003 info.input_frame_width = last_captured_frame_format.width; 2002 info.input_frame_width = last_captured_frame_format.width;
2004 info.input_frame_height = last_captured_frame_format.height; 2003 info.input_frame_height = last_captured_frame_format.height;
2005 } 2004 }
2006 2005
2007 // Get bandwidth limitation info from stream_->GetStats(). 2006 // Get bandwidth limitation info from stream_->GetStats().
2008 // Input resolution (output from video_adapter) can be further scaled down or 2007 // Input resolution (output from video_adapter) can be further scaled down or
2009 // higher video layer(s) can be dropped due to bitrate constraints. 2008 // higher video layer(s) can be dropped due to bitrate constraints.
2010 // Note, adapt_changes only include changes from the video_adapter. 2009 // Note, adapt_changes only include changes from the video_adapter.
2011 if (stats.bw_limited_resolution) 2010 if (stats.bw_limited_resolution)
2012 info.adapt_reason |= CoordinatedVideoAdapter::ADAPTREASON_BANDWIDTH; 2011 info.adapt_reason |= CoordinatedVideoAdapter::ADAPTREASON_BANDWIDTH;
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
2514 rtx_mapping[video_codecs[i].codec.id] != 2513 rtx_mapping[video_codecs[i].codec.id] !=
2515 fec_settings.red_payload_type) { 2514 fec_settings.red_payload_type) {
2516 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2515 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2517 } 2516 }
2518 } 2517 }
2519 2518
2520 return video_codecs; 2519 return video_codecs;
2521 } 2520 }
2522 2521
2523 } // namespace cricket 2522 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698