liyujie
2025-08-28 d9927380ed7c8366f762049be9f3fee225860833
android/hardware/aw/camera/3_4/v4l2_wrapper.cpp
....@@ -95,7 +95,7 @@
9595
9696 V4L2Wrapper::~V4L2Wrapper() {}
9797
98
-int V4L2Wrapper::Connect(STREAM_SERIAL ss) {
98
+int V4L2Wrapper::Connect(STREAM_SERIAL ss, int merge_status) {
9999 HAL_LOG_ENTER();
100100 std::lock_guard<std::mutex> lock(connection_lock_);
101101 std::string device_path;
....@@ -107,19 +107,23 @@
107107 case MAIN_STREAM_BLOB:
108108 case MAIN_MIRROR_STREAM:
109109 case MAIN_MIRROR_STREAM_BLOB:
110
- if (Support_Id == 0) {
111
- device_path = MAIN_STREAM_PATH;
112
- }
113
- tmpss = MAIN_STREAM;
110
+ if (device_id_ == 0 && merge_status) {
111
+ device_path = MAIN_MERGE_STREAM_PATH;
112
+ } else if (device_id_ == 0 && merge_status == 0) {
113
+ device_path = MAIN_STREAM_PATH;
114
+ }
115
+ tmpss = MAIN_STREAM;
114116 break;
115117 case SUB_0_STREAM:
116118 case SUB_0_STREAM_BLOB:
117119 case SUB_0_MIRROR_STREAM:
118120 case SUB_0_MIRROR_STREAM_BLOB:
119
- if (Support_Id == 0) {
120
- device_path = SUB_0_STREAM_PATH;
121
- }
122
- tmpss = SUB_0_STREAM;
121
+ if (device_id_ == 0 && merge_status) {
122
+ device_path = SUB_0_MERGE_STREAM_PATH;
123
+ } else if (device_id_ == 0 && merge_status == 0) {
124
+ device_path = SUB_0_STREAM_PATH;
125
+ }
126
+ tmpss = SUB_0_STREAM;
123127 break;
124128 default:
125129 HAL_LOGE("Failed to set stream device_path.");
....@@ -141,13 +145,15 @@
141145
142146 std::shared_ptr<V4L2Stream> stream(V4L2Stream::NewV4L2Stream(device_id_,
143147 device_path,
144
- mCameraConfig));
148
+ mCameraConfig,
149
+ merge_status
150
+ ));
145151 if (!stream) {
146152 HAL_LOGE("Failed to initialize stream helper.");
147153 return -1;
148154 }
149155
150
- stream_connection[tmpss].reset(new ConnectionStream(stream));
156
+ stream_connection[tmpss].reset(new ConnectionStream(stream, merge_status));
151157 if (stream_connection[tmpss]->status()) {
152158 HAL_LOGE("Failed to connect to device: %d.",
153159 stream_connection[tmpss]->status());
....@@ -168,18 +174,18 @@
168174 case MAIN_STREAM_BLOB:
169175 case MAIN_MIRROR_STREAM:
170176 case MAIN_MIRROR_STREAM_BLOB:
171
- if (device_id_ == 0) {
172
- device_path = MAIN_STREAM_PATH;
173
- }
177
+ //if (device_id_ == 0) {
178
+ // device_path = MAIN_STREAM_PATH;
179
+ //}
174180 tmpss = MAIN_STREAM;
175181 break;
176182 case SUB_0_STREAM:
177183 case SUB_0_STREAM_BLOB:
178184 case SUB_0_MIRROR_STREAM:
179185 case SUB_0_MIRROR_STREAM_BLOB:
180
- if (device_id_ == 0) {
181
- device_path = SUB_0_STREAM_PATH;
182
- }
186
+ //if (device_id_ == 0) {
187
+ // device_path = SUB_0_STREAM_PATH;
188
+ //}
183189 tmpss = SUB_0_STREAM;
184190 break;
185191 default:
....@@ -194,12 +200,12 @@
194200 return;
195201 }
196202
197
- if (device_id_ == 1 && tmpss == MAIN_STREAM) {
198
- device_path = MAIN_FRONT_STREAM_PATH;
199
- }
200
- if (device_id_ == 1 && tmpss == SUB_0_STREAM) {
201
- device_path = SUB_0_FRONT_STREAM_PATH;
202
- }
203
+ //if (device_id_ == 1 && tmpss == MAIN_STREAM) {
204
+ // device_path = MAIN_FRONT_STREAM_PATH;
205
+ //}
206
+ //if (device_id_ == 1 && tmpss == SUB_0_STREAM) {
207
+ // device_path = SUB_0_FRONT_STREAM_PATH;
208
+ //}
203209
204210 --connection_count_[tmpss];
205211 if (connection_count_[tmpss] > 0) {