RESOLVED FIXED 226219
Support H264 profiles in MediaRecorder
https://bugs.webkit.org/show_bug.cgi?id=226219
Summary Support H264 profiles in MediaRecorder
youenn fablet
Reported 2021-05-25 05:51:00 PDT
Support H264 profiles in MediaRecorder
Attachments
Patch (15.05 KB, patch)
2021-05-25 05:56 PDT, youenn fablet
no flags
Patch (15.18 KB, patch)
2021-05-25 07:08 PDT, youenn fablet
no flags
Patch (15.67 KB, patch)
2021-05-27 00:37 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2021-05-25 05:51:14 PDT
youenn fablet
Comment 2 2021-05-25 05:56:42 PDT
youenn fablet
Comment 3 2021-05-25 07:08:10 PDT
Eric Carlson
Comment 4 2021-05-25 09:21:13 PDT
Comment on attachment 429652 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429652&action=review > Source/WebCore/ChangeLog:11 > + By default, use baseline profile, which is not VideoToolbox profile but has wider decoding support. I'm not sure what you mean by "which is not VideoToolbox profile but has wider decoding support", it sounds like you are saying that VideoToolbox doesn't support baseline. > Source/WebCore/platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm:52 > + if (startsWithLettersIgnoringASCIICase(codec, "avc1.") && codec.length() >= 11) { > + if (codec[5] == '6' && codec[6] == '4') > + profile = Profile::High; > + else if (codec[5] == '4' && (codec[6] == 'd' || codec[6] == 'D')) > + profile = Profile::Main; > + break; Do we want to use Baseline if the configuration is not supported or invalid? It is probably worth logging in that case whatever we do. > Source/WebCore/platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm:165 > + RELEASE_LOG_ERROR_IF(error, MediaStream, "VideoSampleBufferCompressor VTSessionSetProperty kVTCompressionPropertyKey_ProfileLevel failed with %d", error); Probably with logging what profile failed.
youenn fablet
Comment 5 2021-05-25 11:57:58 PDT
(In reply to Eric Carlson from comment #4) > Comment on attachment 429652 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=429652&action=review > > > Source/WebCore/ChangeLog:11 > > + By default, use baseline profile, which is not VideoToolbox profile but has wider decoding support. > > I'm not sure what you mean by "which is not VideoToolbox profile but has > wider decoding support", it sounds like you are saying that VideoToolbox > doesn't support baseline. It is not VideoToolbox default apparently. > > > Source/WebCore/platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm:52 > > + if (startsWithLettersIgnoringASCIICase(codec, "avc1.") && codec.length() >= 11) { > > + if (codec[5] == '6' && codec[6] == '4') > > + profile = Profile::High; > > + else if (codec[5] == '4' && (codec[6] == 'd' || codec[6] == 'D')) > > + profile = Profile::Main; > > + break; > > Do we want to use Baseline if the configuration is not supported or invalid? > It is probably worth logging in that case whatever we do. I'll check whether we have cases where baseline, main or high are not supported. If it fails, then we use the OS default, which is not too bad. > > Source/WebCore/platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm:165 > > + RELEASE_LOG_ERROR_IF(error, MediaStream, "VideoSampleBufferCompressor VTSessionSetProperty kVTCompressionPropertyKey_ProfileLevel failed with %d", error); > > Probably with logging what profile failed. OK.
Eric Carlson
Comment 6 2021-05-25 12:11:51 PDT
Comment on attachment 429652 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429652&action=review >>> Source/WebCore/platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm:52 >>> + break; >> >> Do we want to use Baseline if the configuration is not supported or invalid? It is probably worth logging in that case whatever we do. > > I'll check whether we have cases where baseline, main or high are not supported. > If it fails, then we use the OS default, which is not too bad. I meant should we use baseline if the specified profile isn't supported or is invalid but now that I look, the spec says we should throw if we don't support the MIME type: 3. If invoking `is type supported` with options’ mimeType member as its argument returns false, throw a NotSupportedError DOMException and abort these steps. so this isn't correct. This means the logic should also be used by MediaRecorderProvider::isSupported so a page can find out what we support.
youenn fablet
Comment 7 2021-05-27 00:37:06 PDT
youenn fablet
Comment 8 2021-05-27 02:39:15 PDT
I changed the patch to use baseline as a default if mime type profile does not stick. > This means the logic should also be used by > MediaRecorderProvider::isSupported so a page can find out what we support. Right but this logic is in GPUProcess so we do not have it synchronously. In any case, I believe baseline is supported everywhere. If other profiles are not supported, we will use baseline which is not too bad. We can try to improve feature detection as a follow-up patch.
EWS
Comment 9 2021-05-27 03:19:26 PDT
Committed r278158 (238202@main): <https://commits.webkit.org/238202@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 429853 [details].
Note You need to log in before you can comment on or make changes to this bug.