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

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

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