-
-
Notifications
You must be signed in to change notification settings - Fork 620
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
Fix metadata not coming through when sending sampleBuffers #1074
Conversation
I had the same issue as #892 and fixed it with this. |
Sources/RTMP/RTMPStream.swift
Outdated
@@ -430,17 +430,14 @@ open class RTMPStream: NetStream { | |||
open func createMetaData() -> ASObject { | |||
metadata.removeAll() | |||
#if os(iOS) || os(macOS) | |||
if let _: AVCaptureInput = mixer.videoIO.input { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not good. This code will send video and audio metadata always. I don't want send.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please override RTMPStream
.
class YourRTMPStream: RTMPStream {
override func createMetadata() -> ASObject {
...
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I didn't think of the case that a user might want to only send video or audio but not both.
I made a new class where user can set flags to specify what kind of sampleBuffer they intend to send.
Hope this is okay, let me know if more changes are needed. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. Just as I thought 👍 I think this PR is good for an example application
This PR is not generic. Please consider to use your application code. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I have the issue that I can't use this in my application code because mixer.videoIO and mixer.audioIO have 'internal' protection level, so my app cannot access them. Is there any way to send metadata for apps that use the appendSampleBuffer method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can access videoSetting or audioSetting properties.
- Private
- metadata["width"] = mixer.videoIO.codec.width
- metadata[“height”] = mixer.videoIO.codec.height
- metadata["audiobitrate"] = mixer.audioIO.codec.bitrate
- Public
- metadata["width"] = videoSetting[“width”]
- metadata["height"] = videoSetting["height"]
- metadata["audiobitrate"] = audioSetting["bitrate"]
This reverts commit 11eb7ad.
…o metadata should be set.
ああ、これで分かった。教えてくれてどうもありがとうございます。このPRを閉めます。 |
Description & motivation
Type of change
Please delete options that are not relevant.
Screenshots: