webrtc/sdk/objc/Framework
Anders Carlsson 4df8e1ab94 iOS: H264 encoder crash on disabled stream
The H264 encoder defaults to using the kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
pixel format. If the frames coming into the encoder is RTCCVPixelBuffer frames,
we check the pixel format in the contained CVPixelBuffer and send the same format
to the encoder when possible, by switching the encoder's pixel format. When we
receive frames with buffers conforming to the RTCI420Buffer protocol, we copy
the frame contents to the target pixel buffer, hardcoded to be the default NV12.

This works except when switching incoming frames from RTCCVPixelBuffer frames to
I420 frames during runtime. If we received RTCCVPixelBuffers wrapping e.g. an
RGB CVPixelBuffer, the encoder's pixel format have been changed to RGB. If we
now get incoming frames in I420, we must convert these to RGB instead of NV12
to match the encoder's format.

This bug can be triggered by calling `[_localVideoTrack setIsEnabled:NO]` in
`ARDAppClient.m`. This will make the stream start sending black i420 frames to
the encoder.

This CL fixes this by resetting the compression session with the default NV12
format if the input frame type changes from native to I420.

Bug: webrtc:8638
Change-Id: I5d784d204b7b1d09313a0f4cea6302ea72e9ed94
Reviewed-on: https://webrtc-review.googlesource.com/33260
Reviewed-by: Peter Hanspers <peterhanspers@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Anders Carlsson <andersc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21382}
2017-12-20 13:42:06 +00:00
..
Classes iOS: H264 encoder crash on disabled stream 2017-12-20 13:42:06 +00:00
Headers/WebRTC Remove all code for iOS 8 and below. 2017-12-01 14:25:46 +00:00
Modules Moving src/webrtc into src/. 2017-09-15 04:25:06 +00:00
UnitTests Reland "Add file capturer to AppRTCMobile on simulator." 2017-11-24 15:06:39 +00:00
Info.plist Moving src/webrtc into src/. 2017-09-15 04:25:06 +00:00