OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 namespace webrtc { | 26 namespace webrtc { |
27 | 27 |
28 VideoStreamDecoder::VideoStreamDecoder( | 28 VideoStreamDecoder::VideoStreamDecoder( |
29 vcm::VideoReceiver* video_receiver, | 29 vcm::VideoReceiver* video_receiver, |
30 VCMFrameTypeCallback* vcm_frame_type_callback, | 30 VCMFrameTypeCallback* vcm_frame_type_callback, |
31 VCMPacketRequestCallback* vcm_packet_request_callback, | 31 VCMPacketRequestCallback* vcm_packet_request_callback, |
32 bool enable_nack, | 32 bool enable_nack, |
33 bool enable_fec, | 33 bool enable_fec, |
34 ReceiveStatisticsProxy* receive_statistics_proxy, | 34 ReceiveStatisticsProxy* receive_statistics_proxy, |
35 rtc::VideoSinkInterface<VideoFrame>* incoming_video_stream, | 35 rtc::VideoSinkInterface<VideoFrame>* incoming_video_stream) |
36 I420FrameCallback* pre_render_callback) | |
37 : video_receiver_(video_receiver), | 36 : video_receiver_(video_receiver), |
38 receive_stats_callback_(receive_statistics_proxy), | 37 receive_stats_callback_(receive_statistics_proxy), |
39 incoming_video_stream_(incoming_video_stream), | 38 incoming_video_stream_(incoming_video_stream), |
40 pre_render_callback_(pre_render_callback), | |
41 last_rtt_ms_(0) { | 39 last_rtt_ms_(0) { |
42 RTC_DCHECK(video_receiver_); | 40 RTC_DCHECK(video_receiver_); |
43 | 41 |
44 static const int kMaxPacketAgeToNack = 450; | 42 static const int kMaxPacketAgeToNack = 450; |
45 static const int kMaxNackListSize = 250; | 43 static const int kMaxNackListSize = 250; |
46 video_receiver_->SetNackSettings(kMaxNackListSize, | 44 video_receiver_->SetNackSettings(kMaxNackListSize, |
47 kMaxPacketAgeToNack, 0); | 45 kMaxPacketAgeToNack, 0); |
48 video_receiver_->RegisterReceiveCallback(this); | 46 video_receiver_->RegisterReceiveCallback(this); |
49 video_receiver_->RegisterFrameTypeCallback(vcm_frame_type_callback); | 47 video_receiver_->RegisterFrameTypeCallback(vcm_frame_type_callback); |
50 video_receiver_->RegisterReceiveStatisticsCallback(this); | 48 video_receiver_->RegisterReceiveStatisticsCallback(this); |
(...skipping 19 matching lines...) Expand all Loading... |
70 video_receiver_->RegisterFrameTypeCallback(nullptr); | 68 video_receiver_->RegisterFrameTypeCallback(nullptr); |
71 video_receiver_->RegisterReceiveCallback(nullptr); | 69 video_receiver_->RegisterReceiveCallback(nullptr); |
72 } | 70 } |
73 | 71 |
74 // Do not acquire the lock of |video_receiver_| in this function. Decode | 72 // Do not acquire the lock of |video_receiver_| in this function. Decode |
75 // callback won't necessarily be called from the decoding thread. The decoding | 73 // callback won't necessarily be called from the decoding thread. The decoding |
76 // thread may have held the lock when calling VideoDecoder::Decode, Reset, or | 74 // thread may have held the lock when calling VideoDecoder::Decode, Reset, or |
77 // Release. Acquiring the same lock in the path of decode callback can deadlock. | 75 // Release. Acquiring the same lock in the path of decode callback can deadlock. |
78 int32_t VideoStreamDecoder::FrameToRender(VideoFrame& video_frame, | 76 int32_t VideoStreamDecoder::FrameToRender(VideoFrame& video_frame, |
79 rtc::Optional<uint8_t> qp) { | 77 rtc::Optional<uint8_t> qp) { |
80 if (pre_render_callback_) { | |
81 // Post processing is not supported if the frame is backed by a texture. | |
82 if (!video_frame.video_frame_buffer()->native_handle()) { | |
83 pre_render_callback_->FrameCallback(&video_frame); | |
84 } | |
85 } | |
86 | |
87 receive_stats_callback_->OnDecodedFrame(qp); | 78 receive_stats_callback_->OnDecodedFrame(qp); |
88 incoming_video_stream_->OnFrame(video_frame); | 79 incoming_video_stream_->OnFrame(video_frame); |
89 | 80 |
90 return 0; | 81 return 0; |
91 } | 82 } |
92 | 83 |
93 int32_t VideoStreamDecoder::ReceivedDecodedReferenceFrame( | 84 int32_t VideoStreamDecoder::ReceivedDecodedReferenceFrame( |
94 const uint64_t picture_id) { | 85 const uint64_t picture_id) { |
95 RTC_NOTREACHED(); | 86 RTC_NOTREACHED(); |
96 return 0; | 87 return 0; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 127 |
137 void VideoStreamDecoder::OnCompleteFrame(bool is_keyframe, size_t size_bytes) {} | 128 void VideoStreamDecoder::OnCompleteFrame(bool is_keyframe, size_t size_bytes) {} |
138 | 129 |
139 void VideoStreamDecoder::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) { | 130 void VideoStreamDecoder::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) { |
140 video_receiver_->SetReceiveChannelParameters(max_rtt_ms); | 131 video_receiver_->SetReceiveChannelParameters(max_rtt_ms); |
141 | 132 |
142 rtc::CritScope lock(&crit_); | 133 rtc::CritScope lock(&crit_); |
143 last_rtt_ms_ = avg_rtt_ms; | 134 last_rtt_ms_ = avg_rtt_ms; |
144 } | 135 } |
145 } // namespace webrtc | 136 } // namespace webrtc |
OLD | NEW |