OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #ifndef WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_ | 11 #ifndef WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_ |
12 #define WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_ | 12 #define WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
| 17 #include "webrtc/call/syncable.h" |
17 #include "webrtc/common_video/include/incoming_video_stream.h" | 18 #include "webrtc/common_video/include/incoming_video_stream.h" |
18 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
19 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" | 20 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" |
20 #include "webrtc/modules/video_coding/frame_buffer2.h" | 21 #include "webrtc/modules/video_coding/frame_buffer2.h" |
21 #include "webrtc/modules/video_coding/video_coding_impl.h" | 22 #include "webrtc/modules/video_coding/video_coding_impl.h" |
22 #include "webrtc/system_wrappers/include/clock.h" | 23 #include "webrtc/system_wrappers/include/clock.h" |
23 #include "webrtc/video/receive_statistics_proxy.h" | 24 #include "webrtc/video/receive_statistics_proxy.h" |
24 #include "webrtc/video/rtp_stream_receiver.h" | 25 #include "webrtc/video/rtp_stream_receiver.h" |
25 #include "webrtc/video/rtp_streams_synchronizer.h" | 26 #include "webrtc/video/rtp_streams_synchronizer.h" |
26 #include "webrtc/video/transport_adapter.h" | 27 #include "webrtc/video/transport_adapter.h" |
27 #include "webrtc/video/video_stream_decoder.h" | 28 #include "webrtc/video/video_stream_decoder.h" |
28 #include "webrtc/video_receive_stream.h" | 29 #include "webrtc/video_receive_stream.h" |
29 | 30 |
30 namespace webrtc { | 31 namespace webrtc { |
31 | 32 |
32 class CallStats; | 33 class CallStats; |
33 class CongestionController; | 34 class CongestionController; |
34 class IvfFileWriter; | 35 class IvfFileWriter; |
35 class ProcessThread; | 36 class ProcessThread; |
36 class RTPFragmentationHeader; | 37 class RTPFragmentationHeader; |
37 class VoiceEngine; | |
38 class VieRemb; | 38 class VieRemb; |
39 class VCMTiming; | 39 class VCMTiming; |
40 class VCMJitterEstimator; | 40 class VCMJitterEstimator; |
41 | 41 |
42 namespace internal { | 42 namespace internal { |
43 | 43 |
44 class VideoReceiveStream : public webrtc::VideoReceiveStream, | 44 class VideoReceiveStream : public webrtc::VideoReceiveStream, |
45 public rtc::VideoSinkInterface<VideoFrame>, | 45 public rtc::VideoSinkInterface<VideoFrame>, |
46 public EncodedImageCallback, | 46 public EncodedImageCallback, |
47 public NackSender, | 47 public NackSender, |
48 public KeyFrameRequestSender, | 48 public KeyFrameRequestSender, |
49 public video_coding::OnCompleteFrameCallback { | 49 public video_coding::OnCompleteFrameCallback, |
| 50 public Syncable { |
50 public: | 51 public: |
51 VideoReceiveStream(int num_cpu_cores, | 52 VideoReceiveStream(int num_cpu_cores, |
52 CongestionController* congestion_controller, | 53 CongestionController* congestion_controller, |
53 PacketRouter* packet_router, | 54 PacketRouter* packet_router, |
54 VideoReceiveStream::Config config, | 55 VideoReceiveStream::Config config, |
55 webrtc::VoiceEngine* voice_engine, | |
56 ProcessThread* process_thread, | 56 ProcessThread* process_thread, |
57 CallStats* call_stats, | 57 CallStats* call_stats, |
58 VieRemb* remb); | 58 VieRemb* remb); |
59 ~VideoReceiveStream() override; | 59 ~VideoReceiveStream() override; |
60 | 60 |
61 void SignalNetworkState(NetworkState state); | 61 void SignalNetworkState(NetworkState state); |
62 bool DeliverRtcp(const uint8_t* packet, size_t length); | 62 bool DeliverRtcp(const uint8_t* packet, size_t length); |
63 bool DeliverRtp(const uint8_t* packet, | 63 bool DeliverRtp(const uint8_t* packet, |
64 size_t length, | 64 size_t length, |
65 const PacketTime& packet_time); | 65 const PacketTime& packet_time); |
(...skipping 14 matching lines...) Expand all Loading... |
80 std::unique_ptr<video_coding::FrameObject> frame) override; | 80 std::unique_ptr<video_coding::FrameObject> frame) override; |
81 | 81 |
82 // Overrides EncodedImageCallback. | 82 // Overrides EncodedImageCallback. |
83 EncodedImageCallback::Result OnEncodedImage( | 83 EncodedImageCallback::Result OnEncodedImage( |
84 const EncodedImage& encoded_image, | 84 const EncodedImage& encoded_image, |
85 const CodecSpecificInfo* codec_specific_info, | 85 const CodecSpecificInfo* codec_specific_info, |
86 const RTPFragmentationHeader* fragmentation) override; | 86 const RTPFragmentationHeader* fragmentation) override; |
87 | 87 |
88 const Config& config() const { return config_; } | 88 const Config& config() const { return config_; } |
89 | 89 |
90 void SetSyncChannel(VoiceEngine* voice_engine, int audio_channel_id); | 90 void SetSync(Syncable* audio_syncable); |
91 | 91 |
92 // Implements NackSender. | 92 // Implements NackSender. |
93 void SendNack(const std::vector<uint16_t>& sequence_numbers) override; | 93 void SendNack(const std::vector<uint16_t>& sequence_numbers) override; |
94 | 94 |
95 // Implements KeyFrameRequestSender. | 95 // Implements KeyFrameRequestSender. |
96 void RequestKeyFrame() override; | 96 void RequestKeyFrame() override; |
97 | 97 |
98 // Takes ownership of the file, is responsible for closing it later. | 98 // Takes ownership of the file, is responsible for closing it later. |
99 // Calling this method will close and finalize any current log. | 99 // Calling this method will close and finalize any current log. |
100 // Giving rtc::kInvalidPlatformFileValue disables logging. | 100 // Giving rtc::kInvalidPlatformFileValue disables logging. |
101 // If a frame to be written would make the log too large the write fails and | 101 // If a frame to be written would make the log too large the write fails and |
102 // the log is closed and finalized. A |byte_limit| of 0 means no limit. | 102 // the log is closed and finalized. A |byte_limit| of 0 means no limit. |
103 void EnableEncodedFrameRecording(rtc::PlatformFile file, | 103 void EnableEncodedFrameRecording(rtc::PlatformFile file, |
104 size_t byte_limit) override; | 104 size_t byte_limit) override; |
105 | 105 |
| 106 // Implements Syncable. |
| 107 int id() const override; |
| 108 rtc::Optional<Syncable::Info> GetInfo() const override; |
| 109 uint32_t GetPlayoutTimestamp() const override; |
| 110 void SetMinimumPlayoutDelay(int delay_ms) override; |
| 111 |
106 private: | 112 private: |
107 static bool DecodeThreadFunction(void* ptr); | 113 static bool DecodeThreadFunction(void* ptr); |
108 void Decode(); | 114 void Decode(); |
109 | 115 |
110 TransportAdapter transport_adapter_; | 116 TransportAdapter transport_adapter_; |
111 const VideoReceiveStream::Config config_; | 117 const VideoReceiveStream::Config config_; |
112 const int num_cpu_cores_; | 118 const int num_cpu_cores_; |
113 ProcessThread* const process_thread_; | 119 ProcessThread* const process_thread_; |
114 Clock* const clock_; | 120 Clock* const clock_; |
115 | 121 |
(...skipping 14 matching lines...) Expand all Loading... |
130 std::unique_ptr<IvfFileWriter> ivf_writer_ GUARDED_BY(ivf_writer_lock_); | 136 std::unique_ptr<IvfFileWriter> ivf_writer_ GUARDED_BY(ivf_writer_lock_); |
131 | 137 |
132 // Members for the new jitter buffer experiment. | 138 // Members for the new jitter buffer experiment. |
133 std::unique_ptr<VCMJitterEstimator> jitter_estimator_; | 139 std::unique_ptr<VCMJitterEstimator> jitter_estimator_; |
134 std::unique_ptr<video_coding::FrameBuffer> frame_buffer_; | 140 std::unique_ptr<video_coding::FrameBuffer> frame_buffer_; |
135 }; | 141 }; |
136 } // namespace internal | 142 } // namespace internal |
137 } // namespace webrtc | 143 } // namespace webrtc |
138 | 144 |
139 #endif // WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_ | 145 #endif // WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_ |
OLD | NEW |