Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the TBScreenCapture #143

Closed
wants to merge 6 commits into from
Closed

Conversation

Lucashuang0802
Copy link
Contributor

We have been using this component in vertical solution for a couple iOS apps. We have a feature called screen sharing + annotation. We found it easier to achieve cross-platform annotation if we stream the intrinsic size of a UIView. Here is the list of modification:

  • remove the resize method that is for fixing an edge limit issue introduced from Chromium: https://bugs.chromium.org/p/webrtc/issues/detail?id=4643#c7
  • remove config generated from CocoaPods. I am not able to get it up and running by not removing those setting.
  • I have tested it and it seemed okay. But I am not sure due to my webRTC and custom capture knowledge.

@Lucashuang0802
Copy link
Contributor Author

Adding Cesar as he was the one to discuss this with me and I don't know who should review this: @Nitrillo

@@ -110,7 +110,8 @@ - (void)initCapture {
dispatch_source_set_event_handler(_timer, ^{
@autoreleasepool {
__block UIImage* screen = [_self screenshot];
CGImageRef paddedScreen = [self resizeAndPadImage:screen];
// CGImageRef paddedScreen = [self resizeAndPadImage:screen];
CGImageRef paddedScreen = [screen CGImage];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the critical line of the PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove the commented line of code.

#define MAX_EDGE_SIZE_LIMIT 1280.0f
#define EDGE_DIMENSION_COMMON_FACTOR 16.0f
//// defines for image scaling
//// From https://bugs.chromium.org/p/webrtc/issues/detail?id=4643#c7 :
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lazy commenter. lol

@wobbals
Copy link

wobbals commented Jan 31, 2017

I personally prefer not to leave huge blocks of commented code; scm is good for keeping the old stuff around if needed.

As far as the function replaced, those changes were put in to deal with a number of corner cases with respect to keeping proper padding for the source image. A customer sent in an example that basically just used a webview in the root view controller and it was obvious that we needed to do some filtering in order to preserve all the pixels being tested.

Have you had a chance to run these changes through a variety of different frame sizes?

@Lucashuang0802
Copy link
Contributor Author

@wobbals I agree with the huge block. I am going to test on that.

@Lucashuang0802
Copy link
Contributor Author

@wobbals I was testing on iPhone 6s, 5s, 4s, iPad pro, iPad air 2, iPad retina simulator. The previous distorted does go away. My Chrome browser version is: Version 56.0.2924.76 (64-bit). The idea to remove this piece of code is to let another peer connection to know the exact size of the streaming screen. Previously, the video dimension was modified so it's off.

@Lucashuang0802
Copy link
Contributor Author

Please DO NOT MERGE until someone(probably) me to verify the one in Swift sample 😃

@Lucashuang0802
Copy link
Contributor Author

@chetanvangadiTokbox I was testing on iPhone 6s, 5s, 4s, iPad pro, iPad air 2, iPad retina simulator. The previous distorted does go away. My Chrome browser version is: Version 56.0.2924.76 (64-bit). The idea to remove this piece of code is to let another peer connection to know the exact size of the streaming screen. Previously, the video dimension was modified so it's off.

@Lucashuang0802
Copy link
Contributor Author

Lucashuang0802 commented Apr 18, 2017

The expected testing result will be: there is no distorted screen sharing on another peer connection.

@chetanvangadiTokbox
Copy link
Contributor

I tested on iPhone 6 plus, iphone 7 plus and iPad pro, I dont see any distorted image.

// UIGraphicsEndImageContext();
//
// return [newImage CGImage];
//}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is all the code above commented out? If it is no longer used remove it.

@SteveMcFarlin
Copy link
Contributor

SteveMcFarlin commented Apr 19, 2017

@Lucashuang0802 If there is code that is no longer used please remove it rather than commenting it out. The critical line change LGTM, but I think someone on the native team or @wobbals should probably sign off on it. It has been a while since I worked on iOS.

@@ -110,7 +110,7 @@ - (void)initCapture {
dispatch_source_set_event_handler(_timer, ^{
@autoreleasepool {
__block UIImage* screen = [_self screenshot];
CGImageRef paddedScreen = [self resizeAndPadImage:screen];
CGImageRef paddedScreen = [screen CGImage];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the critical line of the change.

@chetanvangadiTokbox
Copy link
Contributor

@Lucashuang0802 We see distorted image with non standard resolution like 1282 x 720 with this merge, do not merge it

vona-ben pushed a commit to vona-ben/opentok-ios-sdk-samples that referenced this pull request Nov 24, 2023
…r-listener

Add subscriber listener to the BasicVideoChat sample
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants