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 18 matching lines...) Expand all Loading... |
69 video_receiver_->RegisterReceiveStatisticsCallback(nullptr); | 67 video_receiver_->RegisterReceiveStatisticsCallback(nullptr); |
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) { // NOLINT | 76 int32_t VideoStreamDecoder::FrameToRender(VideoFrame& video_frame) { // NOLINT |
79 if (pre_render_callback_) { | |
80 // Post processing is not supported if the frame is backed by a texture. | |
81 if (!video_frame.video_frame_buffer()->native_handle()) { | |
82 pre_render_callback_->FrameCallback(&video_frame); | |
83 } | |
84 } | |
85 | |
86 incoming_video_stream_->OnFrame(video_frame); | 77 incoming_video_stream_->OnFrame(video_frame); |
87 | 78 |
88 return 0; | 79 return 0; |
89 } | 80 } |
90 | 81 |
91 int32_t VideoStreamDecoder::ReceivedDecodedReferenceFrame( | 82 int32_t VideoStreamDecoder::ReceivedDecodedReferenceFrame( |
92 const uint64_t picture_id) { | 83 const uint64_t picture_id) { |
93 RTC_NOTREACHED(); | 84 RTC_NOTREACHED(); |
94 return 0; | 85 return 0; |
95 } | 86 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 125 |
135 void VideoStreamDecoder::OnCompleteFrame(bool is_keyframe, size_t size_bytes) {} | 126 void VideoStreamDecoder::OnCompleteFrame(bool is_keyframe, size_t size_bytes) {} |
136 | 127 |
137 void VideoStreamDecoder::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) { | 128 void VideoStreamDecoder::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) { |
138 video_receiver_->SetReceiveChannelParameters(max_rtt_ms); | 129 video_receiver_->SetReceiveChannelParameters(max_rtt_ms); |
139 | 130 |
140 rtc::CritScope lock(&crit_); | 131 rtc::CritScope lock(&crit_); |
141 last_rtt_ms_ = avg_rtt_ms; | 132 last_rtt_ms_ = avg_rtt_ms; |
142 } | 133 } |
143 } // namespace webrtc | 134 } // namespace webrtc |
OLD | NEW |