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 */ |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 const CodecSpecificInfo* codec_specific_info, | 58 const CodecSpecificInfo* codec_specific_info, |
59 const RTPFragmentationHeader* fragmentation); | 59 const RTPFragmentationHeader* fragmentation); |
60 | 60 |
61 VideoEncoder::ScalingSettings GetScalingSettings() const override; | 61 VideoEncoder::ScalingSettings GetScalingSettings() const override; |
62 | 62 |
63 bool SupportsNativeHandle() const override; | 63 bool SupportsNativeHandle() const override; |
64 const char* ImplementationName() const override; | 64 const char* ImplementationName() const override; |
65 | 65 |
66 private: | 66 private: |
67 struct StreamInfo { | 67 struct StreamInfo { |
68 StreamInfo(VideoEncoder* encoder, | 68 StreamInfo(std::unique_ptr<VideoEncoder> encoder, |
69 std::unique_ptr<EncodedImageCallback> callback, | 69 std::unique_ptr<EncodedImageCallback> callback, |
70 uint16_t width, | 70 uint16_t width, |
71 uint16_t height, | 71 uint16_t height, |
72 bool send_stream) | 72 bool send_stream) |
73 : encoder(encoder), | 73 : encoder(std::move(encoder)), |
74 callback(std::move(callback)), | 74 callback(std::move(callback)), |
75 width(width), | 75 width(width), |
76 height(height), | 76 height(height), |
77 key_frame_request(false), | 77 key_frame_request(false), |
78 send_stream(send_stream) {} | 78 send_stream(send_stream) {} |
79 // Deleted by SimulcastEncoderAdapter::DestroyStoredEncoders(). | 79 std::unique_ptr<VideoEncoder> encoder; |
80 VideoEncoder* encoder; | |
81 std::unique_ptr<EncodedImageCallback> callback; | 80 std::unique_ptr<EncodedImageCallback> callback; |
82 uint16_t width; | 81 uint16_t width; |
83 uint16_t height; | 82 uint16_t height; |
84 bool key_frame_request; | 83 bool key_frame_request; |
85 bool send_stream; | 84 bool send_stream; |
86 }; | 85 }; |
87 | 86 |
88 // Populate the codec settings for each simulcast stream. | 87 // Populate the codec settings for each simulcast stream. |
89 static void PopulateStreamCodec(const webrtc::VideoCodec& inst, | 88 static void PopulateStreamCodec(const webrtc::VideoCodec& inst, |
90 int stream_index, | 89 int stream_index, |
(...skipping 10 matching lines...) Expand all Loading... |
101 VideoCodec codec_; | 100 VideoCodec codec_; |
102 std::vector<StreamInfo> streaminfos_; | 101 std::vector<StreamInfo> streaminfos_; |
103 EncodedImageCallback* encoded_complete_callback_; | 102 EncodedImageCallback* encoded_complete_callback_; |
104 std::string implementation_name_; | 103 std::string implementation_name_; |
105 | 104 |
106 // Used for checking the single-threaded access of the encoder interface. | 105 // Used for checking the single-threaded access of the encoder interface. |
107 rtc::SequencedTaskChecker encoder_queue_; | 106 rtc::SequencedTaskChecker encoder_queue_; |
108 | 107 |
109 // Store encoders in between calls to Release and InitEncode, so they don't | 108 // Store encoders in between calls to Release and InitEncode, so they don't |
110 // have to be recreated. Remaining encoders are destroyed by the destructor. | 109 // have to be recreated. Remaining encoders are destroyed by the destructor. |
111 std::stack<VideoEncoder*> stored_encoders_; | 110 std::stack<std::unique_ptr<VideoEncoder>> stored_encoders_; |
112 }; | 111 }; |
113 | 112 |
114 } // namespace webrtc | 113 } // namespace webrtc |
115 | 114 |
116 #endif // WEBRTC_MEDIA_ENGINE_SIMULCAST_ENCODER_ADAPTER_H_ | 115 #endif // WEBRTC_MEDIA_ENGINE_SIMULCAST_ENCODER_ADAPTER_H_ |
OLD | NEW |