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

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

Issue 2383093002: Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (Closed)
Patch Set: Deleted a newline. 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << "."; 540 LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << ".";
541 if (!channel->AddRecvStream(sp, true)) { 541 if (!channel->AddRecvStream(sp, true)) {
542 LOG(LS_WARNING) << "Could not create default receive stream."; 542 LOG(LS_WARNING) << "Could not create default receive stream.";
543 } 543 }
544 544
545 channel->SetSink(ssrc, default_sink_); 545 channel->SetSink(ssrc, default_sink_);
546 default_recv_ssrc_ = ssrc; 546 default_recv_ssrc_ = ssrc;
547 return kDeliverPacket; 547 return kDeliverPacket;
548 } 548 }
549 549
550 rtc::VideoSinkInterface<VideoFrame>* 550 rtc::VideoSinkInterface<webrtc::VideoFrame>*
551 DefaultUnsignalledSsrcHandler::GetDefaultSink() const { 551 DefaultUnsignalledSsrcHandler::GetDefaultSink() const {
552 return default_sink_; 552 return default_sink_;
553 } 553 }
554 554
555 void DefaultUnsignalledSsrcHandler::SetDefaultSink( 555 void DefaultUnsignalledSsrcHandler::SetDefaultSink(
556 VideoMediaChannel* channel, 556 VideoMediaChannel* channel,
557 rtc::VideoSinkInterface<VideoFrame>* sink) { 557 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) {
558 default_sink_ = sink; 558 default_sink_ = sink;
559 if (default_recv_ssrc_ != 0) { 559 if (default_recv_ssrc_ != 0) {
560 channel->SetSink(default_recv_ssrc_, default_sink_); 560 channel->SetSink(default_recv_ssrc_, default_sink_);
561 } 561 }
562 } 562 }
563 563
564 WebRtcVideoEngine2::WebRtcVideoEngine2() 564 WebRtcVideoEngine2::WebRtcVideoEngine2()
565 : initialized_(false), 565 : initialized_(false),
566 external_decoder_factory_(NULL), 566 external_decoder_factory_(NULL),
567 external_encoder_factory_(NULL) { 567 external_encoder_factory_(NULL) {
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 return true; 1101 return true;
1102 } 1102 }
1103 1103
1104 // TODO(nisse): The enable argument was used for mute logic which has 1104 // TODO(nisse): The enable argument was used for mute logic which has
1105 // been moved to VideoBroadcaster. So remove the argument from this 1105 // been moved to VideoBroadcaster. So remove the argument from this
1106 // method. 1106 // method.
1107 bool WebRtcVideoChannel2::SetVideoSend( 1107 bool WebRtcVideoChannel2::SetVideoSend(
1108 uint32_t ssrc, 1108 uint32_t ssrc,
1109 bool enable, 1109 bool enable,
1110 const VideoOptions* options, 1110 const VideoOptions* options,
1111 rtc::VideoSourceInterface<cricket::VideoFrame>* source) { 1111 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) {
1112 TRACE_EVENT0("webrtc", "SetVideoSend"); 1112 TRACE_EVENT0("webrtc", "SetVideoSend");
1113 RTC_DCHECK(ssrc != 0); 1113 RTC_DCHECK(ssrc != 0);
1114 LOG(LS_INFO) << "SetVideoSend (ssrc= " << ssrc << ", enable = " << enable 1114 LOG(LS_INFO) << "SetVideoSend (ssrc= " << ssrc << ", enable = " << enable
1115 << ", options: " << (options ? options->ToString() : "nullptr") 1115 << ", options: " << (options ? options->ToString() : "nullptr")
1116 << ", source = " << (source ? "(source)" : "nullptr") << ")"; 1116 << ", source = " << (source ? "(source)" : "nullptr") << ")";
1117 1117
1118 rtc::CritScope stream_lock(&stream_crit_); 1118 rtc::CritScope stream_lock(&stream_crit_);
1119 const auto& kv = send_streams_.find(ssrc); 1119 const auto& kv = send_streams_.find(ssrc);
1120 if (kv == send_streams_.end()) { 1120 if (kv == send_streams_.end()) {
1121 // Allow unknown ssrc only if source is null. 1121 // Allow unknown ssrc only if source is null.
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 if (stream == receive_streams_.end()) { 1342 if (stream == receive_streams_.end()) {
1343 LOG(LS_ERROR) << "Stream not found for ssrc: " << ssrc; 1343 LOG(LS_ERROR) << "Stream not found for ssrc: " << ssrc;
1344 return false; 1344 return false;
1345 } 1345 }
1346 DeleteReceiveStream(stream->second); 1346 DeleteReceiveStream(stream->second);
1347 receive_streams_.erase(stream); 1347 receive_streams_.erase(stream);
1348 1348
1349 return true; 1349 return true;
1350 } 1350 }
1351 1351
1352 bool WebRtcVideoChannel2::SetSink(uint32_t ssrc, 1352 bool WebRtcVideoChannel2::SetSink(
1353 rtc::VideoSinkInterface<VideoFrame>* sink) { 1353 uint32_t ssrc,
1354 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) {
1354 LOG(LS_INFO) << "SetSink: ssrc:" << ssrc << " " 1355 LOG(LS_INFO) << "SetSink: ssrc:" << ssrc << " "
1355 << (sink ? "(ptr)" : "nullptr"); 1356 << (sink ? "(ptr)" : "nullptr");
1356 if (ssrc == 0) { 1357 if (ssrc == 0) {
1357 default_unsignalled_ssrc_handler_.SetDefaultSink(this, sink); 1358 default_unsignalled_ssrc_handler_.SetDefaultSink(this, sink);
1358 return true; 1359 return true;
1359 } 1360 }
1360 1361
1361 rtc::CritScope stream_lock(&stream_crit_); 1362 rtc::CritScope stream_lock(&stream_crit_);
1362 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = 1363 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it =
1363 receive_streams_.find(ssrc); 1364 receive_streams_.find(ssrc);
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 1653
1653 void WebRtcVideoChannel2::WebRtcVideoSendStream::UpdateHistograms() const { 1654 void WebRtcVideoChannel2::WebRtcVideoSendStream::UpdateHistograms() const {
1654 const int kMinRequiredFrames = 200; 1655 const int kMinRequiredFrames = 200;
1655 if (frame_count_ > kMinRequiredFrames) { 1656 if (frame_count_ > kMinRequiredFrames) {
1656 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.CpuLimitedResolutionInPercent", 1657 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.CpuLimitedResolutionInPercent",
1657 cpu_restricted_frame_count_ * 100 / frame_count_); 1658 cpu_restricted_frame_count_ * 100 / frame_count_);
1658 } 1659 }
1659 } 1660 }
1660 1661
1661 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame( 1662 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame(
1662 const VideoFrame& frame) { 1663 const webrtc::VideoFrame& frame) {
1663 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame"); 1664 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame");
1664 webrtc::VideoFrame video_frame(frame.video_frame_buffer(), 1665 webrtc::VideoFrame video_frame(frame.video_frame_buffer(),
1665 frame.rotation(), 1666 frame.rotation(),
1666 frame.timestamp_us()); 1667 frame.timestamp_us());
1667 1668
1668 rtc::CritScope cs(&lock_); 1669 rtc::CritScope cs(&lock_);
1669 1670
1670 if (video_frame.width() != last_frame_info_.width || 1671 if (video_frame.width() != last_frame_info_.width ||
1671 video_frame.height() != last_frame_info_.height || 1672 video_frame.height() != last_frame_info_.height ||
1672 video_frame.rotation() != last_frame_info_.rotation || 1673 video_frame.rotation() != last_frame_info_.rotation ||
(...skipping 22 matching lines...) Expand all
1695 1696
1696 // Forward frame to the encoder regardless if we are sending or not. This is 1697 // Forward frame to the encoder regardless if we are sending or not. This is
1697 // to ensure that the encoder can be reconfigured with the correct frame size 1698 // to ensure that the encoder can be reconfigured with the correct frame size
1698 // as quickly as possible. 1699 // as quickly as possible.
1699 encoder_sink_->OnFrame(video_frame); 1700 encoder_sink_->OnFrame(video_frame);
1700 } 1701 }
1701 1702
1702 bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetVideoSend( 1703 bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetVideoSend(
1703 bool enable, 1704 bool enable,
1704 const VideoOptions* options, 1705 const VideoOptions* options,
1705 rtc::VideoSourceInterface<cricket::VideoFrame>* source) { 1706 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) {
1706 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::SetVideoSend"); 1707 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::SetVideoSend");
1707 RTC_DCHECK_RUN_ON(&thread_checker_); 1708 RTC_DCHECK_RUN_ON(&thread_checker_);
1708 1709
1709 // Ignore |options| pointer if |enable| is false. 1710 // Ignore |options| pointer if |enable| is false.
1710 bool options_present = enable && options; 1711 bool options_present = enable && options;
1711 bool source_changing = source_ != source; 1712 bool source_changing = source_ != source;
1712 if (source_changing) { 1713 if (source_changing) {
1713 DisconnectSource(); 1714 DisconnectSource();
1714 } 1715 }
1715 1716
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 } 2511 }
2511 2512
2512 sink_->OnFrame(frame); 2513 sink_->OnFrame(frame);
2513 } 2514 }
2514 2515
2515 bool WebRtcVideoChannel2::WebRtcVideoReceiveStream::IsDefaultStream() const { 2516 bool WebRtcVideoChannel2::WebRtcVideoReceiveStream::IsDefaultStream() const {
2516 return default_stream_; 2517 return default_stream_;
2517 } 2518 }
2518 2519
2519 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetSink( 2520 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetSink(
2520 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { 2521 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) {
2521 rtc::CritScope crit(&sink_lock_); 2522 rtc::CritScope crit(&sink_lock_);
2522 sink_ = sink; 2523 sink_ = sink;
2523 } 2524 }
2524 2525
2525 std::string 2526 std::string
2526 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetCodecNameFromPayloadType( 2527 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetCodecNameFromPayloadType(
2527 int payload_type) { 2528 int payload_type) {
2528 for (const webrtc::VideoReceiveStream::Decoder& decoder : config_.decoders) { 2529 for (const webrtc::VideoReceiveStream::Decoder& decoder : config_.decoders) {
2529 if (decoder.payload_type == payload_type) { 2530 if (decoder.payload_type == payload_type) {
2530 return decoder.payload_name; 2531 return decoder.payload_name;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
2692 rtx_mapping[video_codecs[i].codec.id] != 2693 rtx_mapping[video_codecs[i].codec.id] !=
2693 ulpfec_config.red_payload_type) { 2694 ulpfec_config.red_payload_type) {
2694 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2695 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2695 } 2696 }
2696 } 2697 }
2697 2698
2698 return video_codecs; 2699 return video_codecs;
2699 } 2700 }
2700 2701
2701 } // namespace cricket 2702 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698