OLD | NEW |
---|---|
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 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1570 } | 1570 } |
1571 | 1571 |
1572 WebRtcVideoChannel2::WebRtcVideoSendStream::~WebRtcVideoSendStream() { | 1572 WebRtcVideoChannel2::WebRtcVideoSendStream::~WebRtcVideoSendStream() { |
1573 DisconnectSource(); | 1573 DisconnectSource(); |
1574 if (stream_ != NULL) { | 1574 if (stream_ != NULL) { |
1575 call_->DestroyVideoSendStream(stream_); | 1575 call_->DestroyVideoSendStream(stream_); |
1576 } | 1576 } |
1577 DestroyVideoEncoder(&allocated_encoder_); | 1577 DestroyVideoEncoder(&allocated_encoder_); |
1578 } | 1578 } |
1579 | 1579 |
1580 static webrtc::VideoFrame CreateBlackFrame(int width, | |
1581 int height, | |
1582 int64_t render_time_ms_, | |
1583 webrtc::VideoRotation rotation) { | |
1584 webrtc::VideoFrame frame; | |
1585 frame.CreateEmptyFrame(width, height, width, (width + 1) / 2, | |
1586 (width + 1) / 2); | |
1587 memset(frame.video_frame_buffer()->MutableDataY(), 16, | |
1588 frame.allocated_size(webrtc::kYPlane)); | |
1589 memset(frame.video_frame_buffer()->MutableDataU(), 128, | |
1590 frame.allocated_size(webrtc::kUPlane)); | |
1591 memset(frame.video_frame_buffer()->MutableDataV(), 128, | |
1592 frame.allocated_size(webrtc::kVPlane)); | |
1593 frame.set_rotation(rotation); | |
1594 frame.set_render_time_ms(render_time_ms_); | |
1595 return frame; | |
1596 } | |
1597 | |
1598 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame( | 1580 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame( |
1599 const VideoFrame& frame) { | 1581 const VideoFrame& frame) { |
1600 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame"); | 1582 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame"); |
1601 webrtc::VideoFrame video_frame(frame.video_frame_buffer(), 0, 0, | 1583 webrtc::VideoFrame video_frame(frame.video_frame_buffer(), 0, 0, |
1602 frame.rotation()); | 1584 frame.rotation()); |
1603 rtc::CritScope cs(&lock_); | 1585 rtc::CritScope cs(&lock_); |
1604 | 1586 |
1605 if (video_frame.width() != last_frame_info_.width || | 1587 if (video_frame.width() != last_frame_info_.width || |
1606 video_frame.height() != last_frame_info_.height || | 1588 video_frame.height() != last_frame_info_.height || |
1607 video_frame.rotation() != last_frame_info_.rotation || | 1589 video_frame.rotation() != last_frame_info_.rotation || |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1684 first_frame_timestamp_ms_ = rtc::Optional<int64_t>(); | 1666 first_frame_timestamp_ms_ = rtc::Optional<int64_t>(); |
1685 | 1667 |
1686 if (source == nullptr && stream_ != nullptr) { | 1668 if (source == nullptr && stream_ != nullptr) { |
1687 LOG(LS_VERBOSE) << "Disabling capturer, sending black frame."; | 1669 LOG(LS_VERBOSE) << "Disabling capturer, sending black frame."; |
1688 // Force this black frame not to be dropped due to timestamp order | 1670 // Force this black frame not to be dropped due to timestamp order |
1689 // check. As IncomingCapturedFrame will drop the frame if this frame's | 1671 // check. As IncomingCapturedFrame will drop the frame if this frame's |
1690 // timestamp is less than or equal to last frame's timestamp, it is | 1672 // timestamp is less than or equal to last frame's timestamp, it is |
1691 // necessary to give this black frame a larger timestamp than the | 1673 // necessary to give this black frame a larger timestamp than the |
1692 // previous one. | 1674 // previous one. |
1693 last_frame_timestamp_ms_ += 1; | 1675 last_frame_timestamp_ms_ += 1; |
1694 stream_->Input()->IncomingCapturedFrame(CreateBlackFrame( | 1676 rtc::scoped_refptr<webrtc::I420Buffer> black_buffer( |
1695 last_frame_info_.width, last_frame_info_.height, | 1677 webrtc::I420Buffer::Create(last_frame_info_.width, |
1678 last_frame_info_.height)); | |
1679 black_buffer->SetToBlack(); | |
1680 | |
1681 stream_->Input()->IncomingCapturedFrame(webrtc::VideoFrame( | |
1682 black_buffer, 0 /* timestamp (90 kHz) */, | |
pbos-webrtc
2016/06/17 12:30:38
Is this (zero-timestamp) the same as before? If so
nisse-webrtc
2016/06/17 13:26:12
Before this cl, the 90 kHz timestamp on the frame
| |
1696 last_frame_timestamp_ms_, last_frame_info_.rotation)); | 1683 last_frame_timestamp_ms_, last_frame_info_.rotation)); |
1697 } | 1684 } |
1698 source_ = source; | 1685 source_ = source; |
1699 } | 1686 } |
1700 } | 1687 } |
1701 | 1688 |
1702 // |source_->AddOrUpdateSink| may not be called while holding |lock_| since | 1689 // |source_->AddOrUpdateSink| may not be called while holding |lock_| since |
1703 // that might cause a lock order inversion. | 1690 // that might cause a lock order inversion. |
1704 if (source_changing && source_) { | 1691 if (source_changing && source_) { |
1705 source_->AddOrUpdateSink(this, sink_wants_); | 1692 source_->AddOrUpdateSink(this, sink_wants_); |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2627 rtx_mapping[video_codecs[i].codec.id] != | 2614 rtx_mapping[video_codecs[i].codec.id] != |
2628 fec_settings.red_payload_type) { | 2615 fec_settings.red_payload_type) { |
2629 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2616 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2630 } | 2617 } |
2631 } | 2618 } |
2632 | 2619 |
2633 return video_codecs; | 2620 return video_codecs; |
2634 } | 2621 } |
2635 | 2622 |
2636 } // namespace cricket | 2623 } // namespace cricket |
OLD | NEW |