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 |
11 #ifndef WEBRTC_VIDEO_VIDEO_STREAM_DECODER_H_ | 11 #ifndef WEBRTC_VIDEO_VIDEO_STREAM_DECODER_H_ |
12 #define WEBRTC_VIDEO_VIDEO_STREAM_DECODER_H_ | 12 #define WEBRTC_VIDEO_VIDEO_STREAM_DECODER_H_ |
13 | 13 |
14 #include <list> | 14 #include <list> |
15 #include <map> | 15 #include <map> |
16 #include <memory> | 16 #include <memory> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/base/criticalsection.h" | 19 #include "webrtc/base/criticalsection.h" |
20 #include "webrtc/base/platform_thread.h" | 20 #include "webrtc/base/platform_thread.h" |
21 #include "webrtc/base/scoped_ref_ptr.h" | 21 #include "webrtc/base/scoped_ref_ptr.h" |
| 22 #include "webrtc/media/base/videosinkinterface.h" |
22 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 23 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
23 #include "webrtc/modules/video_coding/include/video_coding_defines.h" | 24 #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
24 #include "webrtc/typedefs.h" | 25 #include "webrtc/typedefs.h" |
25 #include "webrtc/video/vie_sync_module.h" | 26 #include "webrtc/video/vie_sync_module.h" |
26 | 27 |
27 namespace webrtc { | 28 namespace webrtc { |
28 | 29 |
29 class CallStatsObserver; | 30 class CallStatsObserver; |
30 class ChannelStatsObserver; | 31 class ChannelStatsObserver; |
31 class Config; | 32 class Config; |
32 class EncodedImageCallback; | 33 class EncodedImageCallback; |
33 class I420FrameCallback; | 34 class I420FrameCallback; |
34 class IncomingVideoStream; | |
35 class ReceiveStatisticsProxy; | 35 class ReceiveStatisticsProxy; |
36 class VideoRenderCallback; | 36 class VideoRenderCallback; |
37 class VoEVideoSync; | 37 class VoEVideoSync; |
38 | 38 |
39 namespace vcm { | 39 namespace vcm { |
40 class VideoReceiver; | 40 class VideoReceiver; |
41 } // namespace vcm | 41 } // namespace vcm |
42 | 42 |
43 enum StreamType { | 43 enum StreamType { |
44 kViEStreamTypeNormal = 0, // Normal media stream | 44 kViEStreamTypeNormal = 0, // Normal media stream |
45 kViEStreamTypeRtx = 1 // Retransmission media stream | 45 kViEStreamTypeRtx = 1 // Retransmission media stream |
46 }; | 46 }; |
47 | 47 |
48 class VideoStreamDecoder : public VCMReceiveCallback, | 48 class VideoStreamDecoder : public VCMReceiveCallback, |
49 public VCMReceiveStatisticsCallback, | 49 public VCMReceiveStatisticsCallback, |
50 public VCMDecoderTimingCallback, | 50 public VCMDecoderTimingCallback, |
51 public CallStatsObserver { | 51 public CallStatsObserver { |
52 public: | 52 public: |
53 friend class ChannelStatsObserver; | 53 friend class ChannelStatsObserver; |
54 | 54 |
55 VideoStreamDecoder(vcm::VideoReceiver* video_receiver, | 55 VideoStreamDecoder(vcm::VideoReceiver* video_receiver, |
56 VCMFrameTypeCallback* vcm_frame_type_callback, | 56 VCMFrameTypeCallback* vcm_frame_type_callback, |
57 VCMPacketRequestCallback* vcm_packet_request_callback, | 57 VCMPacketRequestCallback* vcm_packet_request_callback, |
58 bool enable_nack, | 58 bool enable_nack, |
59 bool enable_fec, | 59 bool enable_fec, |
60 ReceiveStatisticsProxy* receive_statistics_proxy, | 60 ReceiveStatisticsProxy* receive_statistics_proxy, |
61 IncomingVideoStream* incoming_video_stream, | 61 rtc::VideoSinkInterface<VideoFrame>* incoming_video_stream, |
62 I420FrameCallback* pre_render_callback); | 62 I420FrameCallback* pre_render_callback); |
63 ~VideoStreamDecoder(); | 63 ~VideoStreamDecoder(); |
64 | 64 |
65 // Implements VCMReceiveCallback. | 65 // Implements VCMReceiveCallback. |
66 int32_t FrameToRender(VideoFrame& video_frame) override; // NOLINT | 66 int32_t FrameToRender(VideoFrame& video_frame) override; // NOLINT |
67 int32_t ReceivedDecodedReferenceFrame(const uint64_t picture_id) override; | 67 int32_t ReceivedDecodedReferenceFrame(const uint64_t picture_id) override; |
68 void OnIncomingPayloadType(int payload_type) override; | 68 void OnIncomingPayloadType(int payload_type) override; |
69 void OnDecoderImplementationName(const char* implementation_name) override; | 69 void OnDecoderImplementationName(const char* implementation_name) override; |
70 | 70 |
71 // Implements VCMReceiveStatisticsCallback. | 71 // Implements VCMReceiveStatisticsCallback. |
(...skipping 10 matching lines...) Expand all Loading... |
82 int min_playout_delay_ms, | 82 int min_playout_delay_ms, |
83 int render_delay_ms) override; | 83 int render_delay_ms) override; |
84 | 84 |
85 void RegisterReceiveStatisticsProxy( | 85 void RegisterReceiveStatisticsProxy( |
86 ReceiveStatisticsProxy* receive_statistics_proxy); | 86 ReceiveStatisticsProxy* receive_statistics_proxy); |
87 | 87 |
88 // Implements StatsObserver. | 88 // Implements StatsObserver. |
89 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; | 89 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; |
90 | 90 |
91 private: | 91 private: |
92 // Assumed to be protected. | |
93 void StartDecodeThread(); | |
94 void StopDecodeThread(); | |
95 | |
96 // Used for all registered callbacks except rendering. | 92 // Used for all registered callbacks except rendering. |
97 rtc::CriticalSection crit_; | 93 rtc::CriticalSection crit_; |
98 | 94 |
99 vcm::VideoReceiver* const video_receiver_; | 95 vcm::VideoReceiver* const video_receiver_; |
100 | 96 |
101 ReceiveStatisticsProxy* const receive_stats_callback_; | 97 ReceiveStatisticsProxy* const receive_stats_callback_; |
102 IncomingVideoStream* const incoming_video_stream_; | 98 rtc::VideoSinkInterface<VideoFrame>* const incoming_video_stream_; |
103 | 99 |
| 100 // TODO(tommi): This callback is basically the same thing as the one above. |
| 101 // We shouldn't need to support both. |
104 I420FrameCallback* const pre_render_callback_; | 102 I420FrameCallback* const pre_render_callback_; |
105 | 103 |
106 int64_t last_rtt_ms_ GUARDED_BY(crit_); | 104 int64_t last_rtt_ms_ GUARDED_BY(crit_); |
107 }; | 105 }; |
108 | 106 |
109 } // namespace webrtc | 107 } // namespace webrtc |
110 | 108 |
111 #endif // WEBRTC_VIDEO_VIDEO_STREAM_DECODER_H_ | 109 #endif // WEBRTC_VIDEO_VIDEO_STREAM_DECODER_H_ |
OLD | NEW |