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

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

Issue 1900673002: Delete webrtc::VideoFrame methods buffer and stride. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 7 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
« no previous file with comments | « webrtc/media/base/videoframe.h ('k') | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('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 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 } 1553 }
1554 1554
1555 WebRtcVideoChannel2::WebRtcVideoSendStream::~WebRtcVideoSendStream() { 1555 WebRtcVideoChannel2::WebRtcVideoSendStream::~WebRtcVideoSendStream() {
1556 DisconnectSource(); 1556 DisconnectSource();
1557 if (stream_ != NULL) { 1557 if (stream_ != NULL) {
1558 call_->DestroyVideoSendStream(stream_); 1558 call_->DestroyVideoSendStream(stream_);
1559 } 1559 }
1560 DestroyVideoEncoder(&allocated_encoder_); 1560 DestroyVideoEncoder(&allocated_encoder_);
1561 } 1561 }
1562 1562
1563 static void CreateBlackFrame(webrtc::VideoFrame* video_frame, 1563 static webrtc::VideoFrame CreateBlackFrame(int width,
1564 int width, 1564 int height,
1565 int height, 1565 int64_t render_time_ms_,
1566 webrtc::VideoRotation rotation) { 1566 webrtc::VideoRotation rotation) {
1567 video_frame->CreateEmptyFrame(width, height, width, (width + 1) / 2, 1567 webrtc::VideoFrame frame;
1568 (width + 1) / 2); 1568 frame.CreateEmptyFrame(width, height, width, (width + 1) / 2,
1569 memset(video_frame->buffer(webrtc::kYPlane), 16, 1569 (width + 1) / 2);
1570 video_frame->allocated_size(webrtc::kYPlane)); 1570 memset(frame.video_frame_buffer()->MutableDataY(), 16,
1571 memset(video_frame->buffer(webrtc::kUPlane), 128, 1571 frame.allocated_size(webrtc::kYPlane));
1572 video_frame->allocated_size(webrtc::kUPlane)); 1572 memset(frame.video_frame_buffer()->MutableDataU(), 128,
1573 memset(video_frame->buffer(webrtc::kVPlane), 128, 1573 frame.allocated_size(webrtc::kUPlane));
1574 video_frame->allocated_size(webrtc::kVPlane)); 1574 memset(frame.video_frame_buffer()->MutableDataV(), 128,
1575 video_frame->set_rotation(rotation); 1575 frame.allocated_size(webrtc::kVPlane));
1576 frame.set_rotation(rotation);
1577 frame.set_render_time_ms(render_time_ms_);
1578 return frame;
1576 } 1579 }
1577 1580
1578 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame( 1581 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame(
1579 const VideoFrame& frame) { 1582 const VideoFrame& frame) {
1580 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame"); 1583 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame");
1581 webrtc::VideoFrame video_frame(frame.video_frame_buffer(), 0, 0, 1584 webrtc::VideoFrame video_frame(frame.video_frame_buffer(), 0, 0,
1582 frame.rotation()); 1585 frame.rotation());
1583 rtc::CritScope cs(&lock_); 1586 rtc::CritScope cs(&lock_);
1584 if (stream_ == NULL) { 1587 if (stream_ == NULL) {
1585 // Frame input before send codecs are configured, dropping frame. 1588 // Frame input before send codecs are configured, dropping frame.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 { 1626 {
1624 rtc::CritScope cs(&lock_); 1627 rtc::CritScope cs(&lock_);
1625 1628
1626 // Reset timestamps to realign new incoming frames to a webrtc timestamp. A 1629 // Reset timestamps to realign new incoming frames to a webrtc timestamp. A
1627 // new capturer may have a different timestamp delta than the previous one. 1630 // new capturer may have a different timestamp delta than the previous one.
1628 first_frame_timestamp_ms_ = rtc::Optional<int64_t>(); 1631 first_frame_timestamp_ms_ = rtc::Optional<int64_t>();
1629 1632
1630 if (source == NULL) { 1633 if (source == NULL) {
1631 if (stream_ != NULL) { 1634 if (stream_ != NULL) {
1632 LOG(LS_VERBOSE) << "Disabling capturer, sending black frame."; 1635 LOG(LS_VERBOSE) << "Disabling capturer, sending black frame.";
1633 webrtc::VideoFrame black_frame;
1634
1635 CreateBlackFrame(&black_frame, last_dimensions_.width,
1636 last_dimensions_.height, last_rotation_);
1637
1638 // Force this black frame not to be dropped due to timestamp order 1636 // Force this black frame not to be dropped due to timestamp order
1639 // check. As IncomingCapturedFrame will drop the frame if this frame's 1637 // check. As IncomingCapturedFrame will drop the frame if this frame's
1640 // timestamp is less than or equal to last frame's timestamp, it is 1638 // timestamp is less than or equal to last frame's timestamp, it is
1641 // necessary to give this black frame a larger timestamp than the 1639 // necessary to give this black frame a larger timestamp than the
1642 // previous one. 1640 // previous one.
1643 last_frame_timestamp_ms_ += 1; 1641 last_frame_timestamp_ms_ += 1;
1644 black_frame.set_render_time_ms(last_frame_timestamp_ms_); 1642 stream_->Input()->IncomingCapturedFrame(
1645 stream_->Input()->IncomingCapturedFrame(black_frame); 1643 CreateBlackFrame(last_dimensions_.width, last_dimensions_.height,
1644 last_frame_timestamp_ms_, last_rotation_));
1645
1646
1646 } 1647 }
1647 } 1648 }
1648 } 1649 }
1649 source_ = source; 1650 source_ = source;
1650 // |source_->AddOrUpdateSink| may not be called while holding |lock_| since 1651 // |source_->AddOrUpdateSink| may not be called while holding |lock_| since
1651 // that might cause a lock order inversion. 1652 // that might cause a lock order inversion.
1652 if (source_) { 1653 if (source_) {
1653 source_->AddOrUpdateSink(this, sink_wants_); 1654 source_->AddOrUpdateSink(this, sink_wants_);
1654 } 1655 }
1655 } 1656 }
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
2586 rtx_mapping[video_codecs[i].codec.id] != 2587 rtx_mapping[video_codecs[i].codec.id] !=
2587 fec_settings.red_payload_type) { 2588 fec_settings.red_payload_type) {
2588 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2589 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2589 } 2590 }
2590 } 2591 }
2591 2592
2592 return video_codecs; 2593 return video_codecs;
2593 } 2594 }
2594 2595
2595 } // namespace cricket 2596 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/base/videoframe.h ('k') | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698