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 |
11 #include "webrtc/media/engine/webrtcvideoengine2.h" | 11 #include "webrtc/media/engine/webrtcvideoengine2.h" |
12 | 12 |
13 #include <stdio.h> | 13 #include <stdio.h> |
14 #include <algorithm> | 14 #include <algorithm> |
15 #include <set> | 15 #include <set> |
16 #include <string> | 16 #include <string> |
17 #include <utility> | 17 #include <utility> |
18 | 18 |
19 #include "webrtc/base/copyonwritebuffer.h" | 19 #include "webrtc/base/copyonwritebuffer.h" |
20 #include "webrtc/base/logging.h" | 20 #include "webrtc/base/logging.h" |
21 #include "webrtc/base/stringutils.h" | 21 #include "webrtc/base/stringutils.h" |
22 #include "webrtc/base/timeutils.h" | 22 #include "webrtc/base/timeutils.h" |
23 #include "webrtc/base/trace_event.h" | 23 #include "webrtc/base/trace_event.h" |
24 #include "webrtc/call.h" | 24 #include "webrtc/call.h" |
25 #include "webrtc/media/engine/constants.h" | 25 #include "webrtc/media/engine/constants.h" |
26 #include "webrtc/media/engine/simulcast.h" | 26 #include "webrtc/media/engine/simulcast.h" |
27 #include "webrtc/media/engine/webrtcmediaengine.h" | 27 #include "webrtc/media/engine/webrtcmediaengine.h" |
28 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" | 28 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" |
29 #include "webrtc/media/engine/webrtcvideoframe.h" | |
30 #include "webrtc/media/engine/webrtcvoiceengine.h" | 29 #include "webrtc/media/engine/webrtcvoiceengine.h" |
31 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 30 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
32 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" | 31 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" |
33 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 32 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
34 #include "webrtc/system_wrappers/include/field_trial.h" | 33 #include "webrtc/system_wrappers/include/field_trial.h" |
35 #include "webrtc/system_wrappers/include/metrics.h" | 34 #include "webrtc/system_wrappers/include/metrics.h" |
36 #include "webrtc/video_decoder.h" | 35 #include "webrtc/video_decoder.h" |
37 #include "webrtc/video_encoder.h" | 36 #include "webrtc/video_encoder.h" |
38 | 37 |
39 namespace cricket { | 38 namespace cricket { |
(...skipping 2463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2503 int64_t elapsed_time_ms = rtp_time_elapsed_since_first_frame / | 2502 int64_t elapsed_time_ms = rtp_time_elapsed_since_first_frame / |
2504 (cricket::kVideoCodecClockrate / 1000); | 2503 (cricket::kVideoCodecClockrate / 1000); |
2505 if (frame.ntp_time_ms() > 0) | 2504 if (frame.ntp_time_ms() > 0) |
2506 estimated_remote_start_ntp_time_ms_ = frame.ntp_time_ms() - elapsed_time_ms; | 2505 estimated_remote_start_ntp_time_ms_ = frame.ntp_time_ms() - elapsed_time_ms; |
2507 | 2506 |
2508 if (sink_ == NULL) { | 2507 if (sink_ == NULL) { |
2509 LOG(LS_WARNING) << "VideoReceiveStream not connected to a VideoSink."; | 2508 LOG(LS_WARNING) << "VideoReceiveStream not connected to a VideoSink."; |
2510 return; | 2509 return; |
2511 } | 2510 } |
2512 | 2511 |
2513 WebRtcVideoFrame render_frame( | 2512 sink_->OnFrame(frame); |
2514 frame.video_frame_buffer(), frame.rotation(), | |
2515 frame.render_time_ms() * rtc::kNumNanosecsPerMicrosec, frame.timestamp()); | |
2516 sink_->OnFrame(render_frame); | |
2517 } | 2513 } |
2518 | 2514 |
2519 bool WebRtcVideoChannel2::WebRtcVideoReceiveStream::IsDefaultStream() const { | 2515 bool WebRtcVideoChannel2::WebRtcVideoReceiveStream::IsDefaultStream() const { |
2520 return default_stream_; | 2516 return default_stream_; |
2521 } | 2517 } |
2522 | 2518 |
2523 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetSink( | 2519 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetSink( |
2524 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { | 2520 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { |
2525 rtc::CritScope crit(&sink_lock_); | 2521 rtc::CritScope crit(&sink_lock_); |
2526 sink_ = sink; | 2522 sink_ = sink; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2696 rtx_mapping[video_codecs[i].codec.id] != | 2692 rtx_mapping[video_codecs[i].codec.id] != |
2697 ulpfec_config.red_payload_type) { | 2693 ulpfec_config.red_payload_type) { |
2698 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2694 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2699 } | 2695 } |
2700 } | 2696 } |
2701 | 2697 |
2702 return video_codecs; | 2698 return video_codecs; |
2703 } | 2699 } |
2704 | 2700 |
2705 } // namespace cricket | 2701 } // namespace cricket |
OLD | NEW |