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

Fix metadata not coming through when sending sampleBuffers #1074

Closed
wants to merge 3 commits into from

Conversation

charmingtoad
Copy link

@charmingtoad charmingtoad commented Oct 13, 2022

Description & motivation

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Screenshots:

@charmingtoad
Copy link
Author

I had the same issue as #892 and fixed it with this.

@@ -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 {
Copy link
Owner

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.

Copy link
Owner

@shogo4405 shogo4405 Oct 16, 2022

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  {
           ...
    }
}

Copy link
Author

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!

Copy link
Owner

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.

Copy link
Author

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?

Copy link
Owner

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"]

@charmingtoad
Copy link
Author

ああ、これで分かった。教えてくれてどうもありがとうございます。このPRを閉めます。

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.

2 participants