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

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

Issue 2383093002: Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (Closed)
Patch Set: objc: Add missing include of video_frame_buffer.h. 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
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/pc/channel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << "."; 513 LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << ".";
514 if (!channel->AddRecvStream(sp, true)) { 514 if (!channel->AddRecvStream(sp, true)) {
515 LOG(LS_WARNING) << "Could not create default receive stream."; 515 LOG(LS_WARNING) << "Could not create default receive stream.";
516 } 516 }
517 517
518 channel->SetSink(ssrc, default_sink_); 518 channel->SetSink(ssrc, default_sink_);
519 default_recv_ssrc_ = ssrc; 519 default_recv_ssrc_ = ssrc;
520 return kDeliverPacket; 520 return kDeliverPacket;
521 } 521 }
522 522
523 rtc::VideoSinkInterface<VideoFrame>* 523 rtc::VideoSinkInterface<webrtc::VideoFrame>*
524 DefaultUnsignalledSsrcHandler::GetDefaultSink() const { 524 DefaultUnsignalledSsrcHandler::GetDefaultSink() const {
525 return default_sink_; 525 return default_sink_;
526 } 526 }
527 527
528 void DefaultUnsignalledSsrcHandler::SetDefaultSink( 528 void DefaultUnsignalledSsrcHandler::SetDefaultSink(
529 VideoMediaChannel* channel, 529 VideoMediaChannel* channel,
530 rtc::VideoSinkInterface<VideoFrame>* sink) { 530 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) {
531 default_sink_ = sink; 531 default_sink_ = sink;
532 if (default_recv_ssrc_ != 0) { 532 if (default_recv_ssrc_ != 0) {
533 channel->SetSink(default_recv_ssrc_, default_sink_); 533 channel->SetSink(default_recv_ssrc_, default_sink_);
534 } 534 }
535 } 535 }
536 536
537 WebRtcVideoEngine2::WebRtcVideoEngine2() 537 WebRtcVideoEngine2::WebRtcVideoEngine2()
538 : initialized_(false), 538 : initialized_(false),
539 external_decoder_factory_(NULL), 539 external_decoder_factory_(NULL),
540 external_encoder_factory_(NULL) { 540 external_encoder_factory_(NULL) {
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 return true; 1055 return true;
1056 } 1056 }
1057 1057
1058 // TODO(nisse): The enable argument was used for mute logic which has 1058 // TODO(nisse): The enable argument was used for mute logic which has
1059 // been moved to VideoBroadcaster. So remove the argument from this 1059 // been moved to VideoBroadcaster. So remove the argument from this
1060 // method. 1060 // method.
1061 bool WebRtcVideoChannel2::SetVideoSend( 1061 bool WebRtcVideoChannel2::SetVideoSend(
1062 uint32_t ssrc, 1062 uint32_t ssrc,
1063 bool enable, 1063 bool enable,
1064 const VideoOptions* options, 1064 const VideoOptions* options,
1065 rtc::VideoSourceInterface<cricket::VideoFrame>* source) { 1065 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) {
1066 TRACE_EVENT0("webrtc", "SetVideoSend"); 1066 TRACE_EVENT0("webrtc", "SetVideoSend");
1067 RTC_DCHECK(ssrc != 0); 1067 RTC_DCHECK(ssrc != 0);
1068 LOG(LS_INFO) << "SetVideoSend (ssrc= " << ssrc << ", enable = " << enable 1068 LOG(LS_INFO) << "SetVideoSend (ssrc= " << ssrc << ", enable = " << enable
1069 << ", options: " << (options ? options->ToString() : "nullptr") 1069 << ", options: " << (options ? options->ToString() : "nullptr")
1070 << ", source = " << (source ? "(source)" : "nullptr") << ")"; 1070 << ", source = " << (source ? "(source)" : "nullptr") << ")";
1071 1071
1072 rtc::CritScope stream_lock(&stream_crit_); 1072 rtc::CritScope stream_lock(&stream_crit_);
1073 const auto& kv = send_streams_.find(ssrc); 1073 const auto& kv = send_streams_.find(ssrc);
1074 if (kv == send_streams_.end()) { 1074 if (kv == send_streams_.end()) {
1075 // Allow unknown ssrc only if source is null. 1075 // Allow unknown ssrc only if source is null.
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 if (stream == receive_streams_.end()) { 1296 if (stream == receive_streams_.end()) {
1297 LOG(LS_ERROR) << "Stream not found for ssrc: " << ssrc; 1297 LOG(LS_ERROR) << "Stream not found for ssrc: " << ssrc;
1298 return false; 1298 return false;
1299 } 1299 }
1300 DeleteReceiveStream(stream->second); 1300 DeleteReceiveStream(stream->second);
1301 receive_streams_.erase(stream); 1301 receive_streams_.erase(stream);
1302 1302
1303 return true; 1303 return true;
1304 } 1304 }
1305 1305
1306 bool WebRtcVideoChannel2::SetSink(uint32_t ssrc, 1306 bool WebRtcVideoChannel2::SetSink(
1307 rtc::VideoSinkInterface<VideoFrame>* sink) { 1307 uint32_t ssrc,
1308 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) {
1308 LOG(LS_INFO) << "SetSink: ssrc:" << ssrc << " " 1309 LOG(LS_INFO) << "SetSink: ssrc:" << ssrc << " "
1309 << (sink ? "(ptr)" : "nullptr"); 1310 << (sink ? "(ptr)" : "nullptr");
1310 if (ssrc == 0) { 1311 if (ssrc == 0) {
1311 default_unsignalled_ssrc_handler_.SetDefaultSink(this, sink); 1312 default_unsignalled_ssrc_handler_.SetDefaultSink(this, sink);
1312 return true; 1313 return true;
1313 } 1314 }
1314 1315
1315 rtc::CritScope stream_lock(&stream_crit_); 1316 rtc::CritScope stream_lock(&stream_crit_);
1316 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it = 1317 std::map<uint32_t, WebRtcVideoReceiveStream*>::iterator it =
1317 receive_streams_.find(ssrc); 1318 receive_streams_.find(ssrc);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 } 1582 }
1582 1583
1583 WebRtcVideoChannel2::WebRtcVideoSendStream::~WebRtcVideoSendStream() { 1584 WebRtcVideoChannel2::WebRtcVideoSendStream::~WebRtcVideoSendStream() {
1584 if (stream_ != NULL) { 1585 if (stream_ != NULL) {
1585 call_->DestroyVideoSendStream(stream_); 1586 call_->DestroyVideoSendStream(stream_);
1586 } 1587 }
1587 DestroyVideoEncoder(&allocated_encoder_); 1588 DestroyVideoEncoder(&allocated_encoder_);
1588 } 1589 }
1589 1590
1590 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame( 1591 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame(
1591 const VideoFrame& frame) { 1592 const webrtc::VideoFrame& frame) {
1592 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame"); 1593 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame");
1593 webrtc::VideoFrame video_frame(frame.video_frame_buffer(), 1594 webrtc::VideoFrame video_frame(frame.video_frame_buffer(),
1594 frame.rotation(), 1595 frame.rotation(),
1595 frame.timestamp_us()); 1596 frame.timestamp_us());
1596 1597
1597 rtc::CritScope cs(&lock_); 1598 rtc::CritScope cs(&lock_);
1598 1599
1599 if (video_frame.width() != last_frame_info_.width || 1600 if (video_frame.width() != last_frame_info_.width ||
1600 video_frame.height() != last_frame_info_.height || 1601 video_frame.height() != last_frame_info_.height ||
1601 video_frame.rotation() != last_frame_info_.rotation || 1602 video_frame.rotation() != last_frame_info_.rotation ||
(...skipping 18 matching lines...) Expand all
1620 1621
1621 // Forward frame to the encoder regardless if we are sending or not. This is 1622 // Forward frame to the encoder regardless if we are sending or not. This is
1622 // to ensure that the encoder can be reconfigured with the correct frame size 1623 // to ensure that the encoder can be reconfigured with the correct frame size
1623 // as quickly as possible. 1624 // as quickly as possible.
1624 encoder_sink_->OnFrame(video_frame); 1625 encoder_sink_->OnFrame(video_frame);
1625 } 1626 }
1626 1627
1627 bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetVideoSend( 1628 bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetVideoSend(
1628 bool enable, 1629 bool enable,
1629 const VideoOptions* options, 1630 const VideoOptions* options,
1630 rtc::VideoSourceInterface<cricket::VideoFrame>* source) { 1631 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) {
1631 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::SetVideoSend"); 1632 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::SetVideoSend");
1632 RTC_DCHECK_RUN_ON(&thread_checker_); 1633 RTC_DCHECK_RUN_ON(&thread_checker_);
1633 1634
1634 // Ignore |options| pointer if |enable| is false. 1635 // Ignore |options| pointer if |enable| is false.
1635 bool options_present = enable && options; 1636 bool options_present = enable && options;
1636 bool source_changing = source_ != source; 1637 bool source_changing = source_ != source;
1637 1638
1638 if (options_present) { 1639 if (options_present) {
1639 VideoOptions old_options = parameters_.options; 1640 VideoOptions old_options = parameters_.options;
1640 parameters_.options.SetAll(*options); 1641 parameters_.options.SetAll(*options);
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
2376 } 2377 }
2377 2378
2378 sink_->OnFrame(frame); 2379 sink_->OnFrame(frame);
2379 } 2380 }
2380 2381
2381 bool WebRtcVideoChannel2::WebRtcVideoReceiveStream::IsDefaultStream() const { 2382 bool WebRtcVideoChannel2::WebRtcVideoReceiveStream::IsDefaultStream() const {
2382 return default_stream_; 2383 return default_stream_;
2383 } 2384 }
2384 2385
2385 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetSink( 2386 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetSink(
2386 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { 2387 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) {
2387 rtc::CritScope crit(&sink_lock_); 2388 rtc::CritScope crit(&sink_lock_);
2388 sink_ = sink; 2389 sink_ = sink;
2389 } 2390 }
2390 2391
2391 std::string 2392 std::string
2392 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetCodecNameFromPayloadType( 2393 WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetCodecNameFromPayloadType(
2393 int payload_type) { 2394 int payload_type) {
2394 for (const webrtc::VideoReceiveStream::Decoder& decoder : config_.decoders) { 2395 for (const webrtc::VideoReceiveStream::Decoder& decoder : config_.decoders) {
2395 if (decoder.payload_type == payload_type) { 2396 if (decoder.payload_type == payload_type) {
2396 return decoder.payload_name; 2397 return decoder.payload_name;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2559 rtx_mapping[video_codecs[i].codec.id] != 2560 rtx_mapping[video_codecs[i].codec.id] !=
2560 ulpfec_config.red_payload_type) { 2561 ulpfec_config.red_payload_type) {
2561 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2562 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2562 } 2563 }
2563 } 2564 }
2564 2565
2565 return video_codecs; 2566 return video_codecs;
2566 } 2567 }
2567 2568
2568 } // namespace cricket 2569 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/pc/channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698