Commit 4f7c39e
committed
avformat/mux: Don't modify packets we don't own
The documentation of av_write_frame explicitly states that the function
does not take ownership of the packets sent to it; while av_write_frame
does not directly unreference the packets after having written them, it
nevertheless modifies the packet in various ways:
1. The timestamps might be modified either by prepare_input_packet or
compute_muxer_pkt_fields.
2. If a bitstream filter gets applied, it takes ownership of the packet
sent to it in av_bsf_send_packet. In case of do_packet_auto_bsf, the end
result is that the returned packet contains the output of the last bsf
in the chain. If an error happens, an empty packet will be returned;
a packet may also simply not lead to any output (vp9_superframe).
This also implies that side data needs to be really copied and can't be
shared with the input packet.
The method choosen here minimizes copying of data; when the input isn't
refcounted and no bitstream filter is applied, the packet's data will
not be copied.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>1 parent df10192 commit 4f7c39e
1 file changed
+26
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
872 | 872 | | |
873 | 873 | | |
874 | 874 | | |
875 | | - | |
| 875 | + | |
876 | 876 | | |
| 877 | + | |
877 | 878 | | |
878 | 879 | | |
879 | | - | |
| 880 | + | |
880 | 881 | | |
881 | 882 | | |
882 | 883 | | |
| |||
887 | 888 | | |
888 | 889 | | |
889 | 890 | | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
890 | 908 | | |
891 | 909 | | |
892 | | - | |
| 910 | + | |
893 | 911 | | |
894 | 912 | | |
895 | 913 | | |
896 | | - | |
| 914 | + | |
897 | 915 | | |
898 | 916 | | |
899 | 917 | | |
900 | 918 | | |
901 | 919 | | |
902 | | - | |
| 920 | + | |
903 | 921 | | |
904 | 922 | | |
905 | 923 | | |
| |||
908 | 926 | | |
909 | 927 | | |
910 | 928 | | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
911 | 932 | | |
912 | 933 | | |
913 | 934 | | |
| |||
0 commit comments