webrtc/sdk/objc/Framework/Classes/VideoToolbox
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
..
helpers.cc Stop using LOG macros in favor of RTC_ prefixed macros. 2017-11-09 11:56:32 +00:00
helpers.h Fixing WebRTC after moving from src/webrtc to src/ 2017-09-15 05:02:56 +00:00
nalu_rewriter.cc Stop using LOG macros in favor of RTC_ prefixed macros. 2017-11-09 11:56:32 +00:00
nalu_rewriter.h Fixing WebRTC after moving from src/webrtc to src/ 2017-09-15 05:02:56 +00:00
nalu_rewriter_unittest.cc Fixing WebRTC after moving from src/webrtc to src/ 2017-09-15 05:02:56 +00:00
objc_video_decoder_factory.h Injectable software video codecs in Obj-C. 2017-10-06 07:36:34 +00:00
objc_video_decoder_factory.mm Injectable software video codecs in Obj-C. 2017-10-06 07:36:34 +00:00
objc_video_encoder_factory.h Injectable software video codecs in Obj-C. 2017-10-06 07:36:34 +00:00
objc_video_encoder_factory.mm Set video codec names in public API using existing cricket constants 2017-11-27 09:01:42 +00:00
RTCVideoDecoderH264.mm Add a way for RTCVideoDecoderH264 to signal decode errors. 2017-12-04 13:31:03 +00:00
RTCVideoEncoderH264.mm iOS: H264 encoder crash on disabled stream 2017-12-20 13:42:06 +00:00