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

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

Issue 1875713002: New peerconnection test case, for video stream forwarding. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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
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 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 memset(video_frame->buffer(webrtc::kUPlane), 128, 1555 memset(video_frame->buffer(webrtc::kUPlane), 128,
1556 video_frame->allocated_size(webrtc::kUPlane)); 1556 video_frame->allocated_size(webrtc::kUPlane));
1557 memset(video_frame->buffer(webrtc::kVPlane), 128, 1557 memset(video_frame->buffer(webrtc::kVPlane), 128,
1558 video_frame->allocated_size(webrtc::kVPlane)); 1558 video_frame->allocated_size(webrtc::kVPlane));
1559 video_frame->set_rotation(rotation); 1559 video_frame->set_rotation(rotation);
1560 } 1560 }
1561 1561
1562 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame( 1562 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame(
1563 const VideoFrame& frame) { 1563 const VideoFrame& frame) {
1564 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame"); 1564 TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame");
1565 webrtc::VideoFrame video_frame(frame.GetVideoFrameBuffer(), 0, 0, 1565 invoker_.AsyncInvoke<void>(
pbos-webrtc 2016/04/08 14:08:56 I really don't want a thread hop here, I've CLs th
perkj_webrtc 2016/04/08 14:34:07 This can wait until then....
nisse-webrtc 2016/04/08 14:57:03 Agreed.
nisse-webrtc 2016/04/11 06:35:39 Can you cc me on that cl?
1566 frame.GetVideoRotation()); 1566 worker_thread_,
1567 rtc::Bind(&WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame_w,
1568 this,
1569 webrtc::VideoFrame(frame.GetVideoFrameBuffer(), 0, 0,
1570 frame.GetVideoRotation()),
1571 frame.GetTimeStamp() / rtc::kNumNanosecsPerMillisec));
1572 }
1573
1574 void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame_w(
1575 webrtc::VideoFrame video_frame, int64_t frame_delta_ms) {
1576 RTC_DCHECK(worker_thread_->IsCurrent());
1567 rtc::CritScope cs(&lock_); 1577 rtc::CritScope cs(&lock_);
1568 if (stream_ == NULL) { 1578 if (stream_ == NULL) {
1569 // Frame input before send codecs are configured, dropping frame. 1579 // Frame input before send codecs are configured, dropping frame.
1570 return; 1580 return;
1571 } 1581 }
1572 1582
1573 int64_t frame_delta_ms = frame.GetTimeStamp() / rtc::kNumNanosecsPerMillisec;
1574 // frame->GetTimeStamp() is essentially a delta, align to webrtc time 1583 // frame->GetTimeStamp() is essentially a delta, align to webrtc time
1575 if (first_frame_timestamp_ms_ == 0) { 1584 if (first_frame_timestamp_ms_ == 0) {
1576 first_frame_timestamp_ms_ = rtc::Time() - frame_delta_ms; 1585 first_frame_timestamp_ms_ = rtc::Time() - frame_delta_ms;
1577 } 1586 }
1578 1587
1579 last_frame_timestamp_ms_ = first_frame_timestamp_ms_ + frame_delta_ms; 1588 last_frame_timestamp_ms_ = first_frame_timestamp_ms_ + frame_delta_ms;
1580 video_frame.set_render_time_ms(last_frame_timestamp_ms_); 1589 video_frame.set_render_time_ms(last_frame_timestamp_ms_);
1581 // Reconfigure codec if necessary. 1590 // Reconfigure codec if necessary.
1582 SetDimensions(video_frame.width(), video_frame.height()); 1591 SetDimensions(video_frame.width(), video_frame.height());
1583 last_rotation_ = video_frame.rotation(); 1592 last_rotation_ = video_frame.rotation();
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
2565 rtx_mapping[video_codecs[i].codec.id] != 2574 rtx_mapping[video_codecs[i].codec.id] !=
2566 fec_settings.red_payload_type) { 2575 fec_settings.red_payload_type) {
2567 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2576 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2568 } 2577 }
2569 } 2578 }
2570 2579
2571 return video_codecs; 2580 return video_codecs;
2572 } 2581 }
2573 2582
2574 } // namespace cricket 2583 } // namespace cricket
OLDNEW
« webrtc/media/engine/webrtcvideoengine2.h ('K') | « webrtc/media/engine/webrtcvideoengine2.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698