-
Notifications
You must be signed in to change notification settings - Fork 112
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
AV1 samplebuilder support (WIP) #264
base: master
Are you sure you want to change the base?
Conversation
I was not able to test further as IsPartitionHead always false |
This adds IsPartitionHead and IsPartitionTail to AV1Packet.
AV1 RTP payload cannot be concatenated without first recovering the omitted OBU length.
Fixed. However, as I've mentioned, this is completely untested, and I'd be very surprised if it worked. The question is whether you agree that this could work in principle, since it is both more efficient and simpler than what you propose. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #264 /- ##
==========================================
- Coverage 86.21% 84.70% -1.52%
==========================================
Files 22 22
Lines 1734 1765 31
==========================================
Hits 1495 1495
- Misses 203 234 31
Partials 36 36
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
AppendToSample implementation is wrong. There are maybe several OBUS in AV1Packet and AppendToSample should run the similar loop as func (p *AV1Packet) Unmarshal But there is much simplier approach much better than my and yours: just return OBULen OBU list right from Unmarshal All my fix was to workaround current useless av1 format. your AppendToSample introduce to keep current format but to produce right format after Unmarshal. Shouldn't we just return all we need from Unmarshal. Yes, we need to allocate for sample but your implementation do the same, but for only one OBU. This is wrong. There maybe multiple OBUs in Av1Packet. |
Interesting.
That's right, and my implementation builds a sample as a sequence of LE128-prefixed OBUs. Are you suggesting a different representation?
https://github.com/jech/galene/blob/master/codecs/codecs.go#L48 This code does the equivalent of AV1Packer.Unmarshal in an efficient manner. I had to write it because Unmarshal was written by people who don't care about efficiency.
Unmarshal is a low-leve function that should run in constant time and perform no allocations. Check the H264 version of Unmarshal, it's done right, it doesn't try to parse the list of NALUs. Please also read the comments in #265 and #266. |
@alexpokotilo Another point is that you cannot reassemble fragmented OBUs in |
@jech, maybe my problem is that I see AppendToSample implementation but don't see its usage in your branch. Could you please finish your version so I can just use it and check it really support all cases. Long story short. You are right and my version is not ideal. I don't like it either. From performance pov it doesn't matter where you process OBUs: in unmarshal method or in AppendToSample right next to it. Now AV1Packet just drop OBUElements on every unmarshal. it doesn't care about previous fragments. I had to use AV1Frame to combine OBUs from AV1Packets as AV1Packet doesn't care about it. What you propose is :
Don't get me wrong please. I admit my initial approach is wrong and I'm starving to test your version but it doesn't exist. I still don't see a problem in adding tail support into AV1Packets the same way H264Packet do and return necessary format from it without adding new interface AppendToSample. at the end of the day you will have to allocate somewhere. Why not in unmarshal ? What so special in this method so that you don't want to do the job there? these Packet structures are used mainly in samplebuilder. You don't add any gain moving processing in new method AppendToSample. If you complain about unmarshal-only approach only from design POV - I'm sorry I don't completely confident to speak from design POV. I'm not Packet approach designer. But If you think your approach gain something to samplebuffer users - please complete it and I will create performance test to check where you are right or not. I think it's time to complete AppendToSample so I can do tests and check whether it works or not. Now I cannot and don't see how I can help to prove your points or argue with them. My main problem with AppendToSample approach is that I don't get what is so special with av1 so we need to handle it different way from h264? do we have tails in h264? yes, we do. How we process them? in unmarshal. Do we do allocation in h264's unmarshals? Yes, in case we have previous tail. Does h264' unmarshal return ready to append buffer? Yes, it is. You want to have lightweight header parser without all body processing - go ahead but this is a different story. Do I agree that AV1Packet made in different way than others Packets? Yes. This is all I can say about it. |
Please look at H264Packet. it does process tails from previous unmarshal call relying on the fact that samplebuffer call unmarshal in correct order. This is what I see in the code at least. Check func (p *H264Packet) Unmarshal(payload []byte) ([]byte, error) and it's p.fuaBuffer processing. If unmarshal didn't rely on packet order this approach would not work for h264. |
Yes, and that's wrong, for at least three reasons:
Alex, let us please do the right thing in AV1, and let's fix H.264. I've started here:
Because Unmarshal is not optional: if you want to work with a packet, you must call Unmarshal. Any other methods are optional, you only call them if you need the functionality. Pion is designed to be suitable for many different applications, from full-featured multimedia applications (that do encoding, decoding and so on) to fast media servers (that want to push massive amounts of packets around while paying as little overhead as possible. We must endeavour to make sure that Pion remains widely usable, and doesn't become optimised for one specific class of applications. |
So maybe add Another method to help these application and keep current interface to others ? |
@jech any plans to continue on this one? If not can you please sum up what needs to be done? maybe somebody take over |
Yes, I'm planning to work on it. I'm actually planning a fairly comprehensive rework of the packet code:
Unfortunately, I won't be able to work on that before the end of October. |
Sounds exciting, please let me know if you would need help with testing. Does this PR is going to solve #273 ? |
An attempt to implement the required hooks for the samplebuilder
to work with AV1. This approach is likely to be both faster and
simpler than the one in #238.
COMPLETELY UNTESTED, DO NOT COMMIT.