Chromium Code Reviews| 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 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1543 const VideoFrame& frame) { | 1543 const VideoFrame& frame) { |
| 1544 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame"); | 1544 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame"); |
| 1545 webrtc::VideoFrame video_frame(frame.GetVideoFrameBuffer(), 0, 0, | 1545 webrtc::VideoFrame video_frame(frame.GetVideoFrameBuffer(), 0, 0, |
| 1546 frame.GetVideoRotation()); | 1546 frame.GetVideoRotation()); |
| 1547 rtc::CritScope cs(&lock_); | 1547 rtc::CritScope cs(&lock_); |
| 1548 if (stream_ == NULL) { | 1548 if (stream_ == NULL) { |
| 1549 // Frame input before send codecs are configured, dropping frame. | 1549 // Frame input before send codecs are configured, dropping frame. |
| 1550 return; | 1550 return; |
| 1551 } | 1551 } |
| 1552 | 1552 |
| 1553 // Not sending, abort early to prevent expensive reconfigurations while | |
| 1554 // setting up codecs etc. | |
| 1555 if (!sending_) | |
| 1556 return; | |
| 1557 | |
| 1558 if (muted_) { | 1553 if (muted_) { |
| 1559 // Create a black frame to transmit instead. | 1554 // Create a black frame to transmit instead. |
| 1560 CreateBlackFrame(&video_frame, | 1555 CreateBlackFrame(&video_frame, |
| 1561 static_cast<int>(frame.GetWidth()), | 1556 static_cast<int>(frame.GetWidth()), |
| 1562 static_cast<int>(frame.GetHeight()), | 1557 static_cast<int>(frame.GetHeight()), |
| 1563 video_frame.rotation()); | 1558 video_frame.rotation()); |
| 1564 } | 1559 } |
| 1565 | 1560 |
| 1566 int64_t frame_delta_ms = frame.GetTimeStamp() / rtc::kNumNanosecsPerMillisec; | 1561 int64_t frame_delta_ms = frame.GetTimeStamp() / rtc::kNumNanosecsPerMillisec; |
| 1567 // frame->GetTimeStamp() is essentially a delta, align to webrtc time | 1562 // frame->GetTimeStamp() is essentially a delta, align to webrtc time |
| 1568 if (first_frame_timestamp_ms_ == 0) { | 1563 if (first_frame_timestamp_ms_ == 0) { |
| 1569 first_frame_timestamp_ms_ = rtc::Time() - frame_delta_ms; | 1564 first_frame_timestamp_ms_ = rtc::Time() - frame_delta_ms; |
| 1570 } | 1565 } |
| 1571 | 1566 |
| 1572 last_frame_timestamp_ms_ = first_frame_timestamp_ms_ + frame_delta_ms; | 1567 last_frame_timestamp_ms_ = first_frame_timestamp_ms_ + frame_delta_ms; |
| 1573 video_frame.set_render_time_ms(last_frame_timestamp_ms_); | 1568 video_frame.set_render_time_ms(last_frame_timestamp_ms_); |
| 1574 // Reconfigure codec if necessary. | 1569 // Reconfigure codec if necessary. |
| 1575 SetDimensions(video_frame.width(), video_frame.height()); | 1570 SetDimensions(video_frame.width(), video_frame.height()); |
| 1576 last_rotation_ = video_frame.rotation(); | 1571 last_rotation_ = video_frame.rotation(); |
| 1577 | 1572 |
| 1573 // Not sending, abort after reconfiguration. Reconfiguration should still | |
| 1574 // occur to permit sending this input as quickly as possible once we go | |
|
Taylor Brandstetter
2016/03/11 21:33:29
nit: "go to" sending or "start" sending
pbos-webrtc
2016/03/11 22:50:42
Done.
| |
| 1575 // sending (without having to reconfigure then). | |
| 1576 if (!sending_) { | |
| 1577 return; | |
| 1578 } | |
| 1579 | |
| 1578 stream_->Input()->IncomingCapturedFrame(video_frame); | 1580 stream_->Input()->IncomingCapturedFrame(video_frame); |
| 1579 } | 1581 } |
| 1580 | 1582 |
| 1581 bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetCapturer( | 1583 bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetCapturer( |
| 1582 VideoCapturer* capturer) { | 1584 VideoCapturer* capturer) { |
| 1583 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::SetCapturer"); | 1585 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::SetCapturer"); |
| 1584 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 1586 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 1585 if (!DisconnectCapturer() && capturer == NULL) { | 1587 if (!DisconnectCapturer() && capturer == NULL) { |
| 1586 return false; | 1588 return false; |
| 1587 } | 1589 } |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2529 rtx_mapping[video_codecs[i].codec.id] != | 2531 rtx_mapping[video_codecs[i].codec.id] != |
| 2530 fec_settings.red_payload_type) { | 2532 fec_settings.red_payload_type) { |
| 2531 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2533 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2532 } | 2534 } |
| 2533 } | 2535 } |
| 2534 | 2536 |
| 2535 return video_codecs; | 2537 return video_codecs; |
| 2536 } | 2538 } |
| 2537 | 2539 |
| 2538 } // namespace cricket | 2540 } // namespace cricket |
| OLD | NEW |