fix(ios) detect orientation when screen sharing

Fixes: https://github.com/jitsi/jitsi-meet/issues/9012
This commit is contained in:
Saúl Ibarra Corretgé 2021-04-16 11:24:01 +02:00 committed by Saúl Ibarra Corretgé
parent c765e08aa1
commit 9e6939d25f
3 changed files with 5 additions and 3 deletions

View File

@ -88,6 +88,7 @@ static const NSInteger kBufferMaxLenght = 10 * 1024;
CGFloat scaleFactor = 2;
size_t width = CVPixelBufferGetWidth(imageBuffer)/scaleFactor;
size_t height = CVPixelBufferGetHeight(imageBuffer)/scaleFactor;
CGImagePropertyOrientation orientation = ((__bridge NSNumber*)CMGetAttachment(sampleBuffer, (__bridge CFStringRef)RPVideoSampleOrientationKey , NULL)).unsignedIntValue;
CGAffineTransform scaleTransform = CGAffineTransformMakeScale(1/scaleFactor, 1/scaleFactor);
NSData *bufferData = [self jpegDataFromPixelBuffer:imageBuffer withScaling:scaleTransform];
@ -99,6 +100,7 @@ static const NSInteger kBufferMaxLenght = 10 * 1024;
CFHTTPMessageSetHeaderFieldValue(httpResponse, (__bridge CFStringRef)@"Content-Length", (__bridge CFStringRef)[NSString stringWithFormat:@"%ld", bufferData.length]);
CFHTTPMessageSetHeaderFieldValue(httpResponse, (__bridge CFStringRef)@"Buffer-Width", (__bridge CFStringRef)[NSString stringWithFormat:@"%ld", width]);
CFHTTPMessageSetHeaderFieldValue(httpResponse, (__bridge CFStringRef)@"Buffer-Height", (__bridge CFStringRef)[NSString stringWithFormat:@"%ld", height]);
CFHTTPMessageSetHeaderFieldValue(httpResponse, (__bridge CFStringRef)@"Buffer-Orientation", (__bridge CFStringRef)[NSString stringWithFormat:@"%u", orientation]);
CFHTTPMessageSetBody(httpResponse, (__bridge CFDataRef)bufferData);

4
package-lock.json generated
View File

@ -14457,8 +14457,8 @@
"integrity": "sha512-iqdJ1KpZbR4XGahgVmaeibB7kDhyMT7wrylINgJaYBY38IAiI0LF32VX1umO4pko6n21YF5I/kSeNQ+OXGqqow=="
},
"react-native-webrtc": {
"version": "github:react-native-webrtc/react-native-webrtc#1343580c0322f265ff0fb22722ac5501c5fd77ad",
"from": "github:react-native-webrtc/react-native-webrtc#1343580c0322f265ff0fb22722ac5501c5fd77ad",
"version": "github:react-native-webrtc/react-native-webrtc#05b7a06e04ad24fe6fa4e6b8118fbd21315152de",
"from": "github:react-native-webrtc/react-native-webrtc#05b7a06e04ad24fe6fa4e6b8118fbd21315152de",
"requires": {
"base64-js": "^1.1.2",
"cross-os": "^1.3.0",

View File

@ -83,7 +83,7 @@
"react-native-svg-transformer": "0.14.3",
"react-native-url-polyfill": "1.2.0",
"react-native-watch-connectivity": "0.4.3",
"react-native-webrtc": "github:react-native-webrtc/react-native-webrtc#1343580c0322f265ff0fb22722ac5501c5fd77ad",
"react-native-webrtc": "github:react-native-webrtc/react-native-webrtc#05b7a06e04ad24fe6fa4e6b8118fbd21315152de",
"react-native-webview": "11.0.2",
"react-native-youtube-iframe": "1.2.3",
"react-redux": "7.1.0",