Why the num_references is 1 for p frames in webrtc? - webrtc

In webrtc, the reference frame for non-keyframe is 1:
frame->num_references = frame->frame_type() == kVideoFrameKey ? 0 : 1;
But for h264, the reference frames can be at most 16? Why it is 1 in webrtc?

I suppose you look on this rtp code https://webrtc.googlesource.com/src/webrtc/+/f54860e9ef0b68e182a01edc994626d21961bc4b/modules/video_coding/rtp_frame_reference_finder.cc
Take a look on other occurrences of frame->num_references in the file and you will see that it is not always 0 or 1.

Related

AviSynth - turn sound off

I am using AviSynth+ and I play an .avs script into VLC (I've installed the AviSynth plugin for VLC).
My script is very basic and it looks like this:
DirectShowSource("D:\MyVideo.asf", fps=25, convertfps=true)
How can I turn off the sound of the video, only for the first two minutes of the video?
I am using Windows 8 - 64 bit
I know that this is a very late answer, but an easy way to do it would be to split the clip into two segments, silence the first segment with Amplify, and then rejoin them:
original = DirectShowSource("D:\MyVideo.asf", fps=25, convertfps=true)
numSeconds = 60 * 2
numFrames = Round(source.FrameRate() * numSeconds)
beginning = source.Trim(0, numFrames - 1, False)
rest = source.Trim(numFrames, 0, False)
beginning.Amplify(0.0) + rest

MBED OS 5.9 LoRA set up in SF7

Do you know how to set up the Spreading Factor to 12 in a Mbed-OS LoRaWAN protocol APIs to connect to a LoRaWAN network using OTAA?
I'm trying to make LoRA node to use Spreading Factor SF12, because the default one is SF7. I know that in the PHY layer we can change Radio configurations. There are several examples to change between the different sub-GHz frequency bands, however, I can't find one on how to change the LoRa modulation SF between 7 and 12 and with a bandwidth of 125 kHz.
I'm using an SX1276 radio at EU 868 MHz config.
In the source code you can find the SF7-12 different configurations, but there is not a clear way to set it up. These configs are the definitions (#define) DR_0, DR_, etc ).
In the configuration file in the Phy part you find some example like this:
"phy": {
"help": "LoRa PHY region. 0 = EU868 (default), 1 = AS923,
2 = AU915, 3 = CN470, 4 = CN779, 5 = EU433,
6 = IN865, 7 = KR920, 8 = US915, 9 = US915_HYBRID",
"value": "0"
},
But there is no examples or description for the Spreading Factor.
I would like to change it via source code, rather than the configuration file.
EDIT 1:
after Jon's answer, I add the following lines, but still not forcing the SF12 Joins.
retcode = lorawan.disable_adaptive_datarate ();
retcode = lorawan.set_datarate (0); // DR_0
Call:
lorawan.set_datarate(0); // SF12 125 KHz
Make sure to:
Disable ADR.
Either use ABP, or call the function above in the JOIN_SUCCESS event handler. This is because join procedure always starts at SF7, and then keeps the data rate on which the join succeeded.

webrtc and peerjs: how to choose H264 instead of vp8?

I do use peerjs https://peerjs.com to stablish connection between 2 peers.
Is there a way to force the use of H264 code instead of VP8 ?
Regards
Update:
You can use setCodecPreferences to achieve the same result, once browsers support it.
Old Answer:
You will have to edit the peerjs code to change codecs.
Basically you will have to update the SDP , more specifically, the video line in the sdp.
The video line will look something like
m=video 60372 UDP/TLS/RTP/SAVPF 96 98 100 101 116 111
The numbers 100 101 etc correspond to the various codecs that the peer support, they are represented by lines like the following:
a=rtpmap:98 VP9/90000
a=rtpmap:96 VP8/90000
So you have to first get the sdp and find out the number for the H264 codec, next move the number to the beginning of the list in the video line.
For example, if 100 is the number of the H264 codec, you need to change the above video line to
m=video 60372 UDP/TLS/RTP/SAVPF 100 96 98 101 116 111
For the caller side, modify the sdp after creating the offer but before setting the localDescription
pc.createOffer().then(function(offer) {
sdp = offer.sdp;
changedsdp = updateCodec(sdp) //Function to modify the sdp
offer.sdp = changedsdp
pc.setLocalDescription(offer)
For the answerer side, modify the sdp after create answer
pc.createAnswer(function(answer) {
sdp = answer.sdp;
changedsdp = updateCodec(sdp) //Function to modify the sdp
answer.sdp = changedsdp
pc.setLocalDescription(answer)

STM32 F4 composite usb device with 2 Bulk Interfaces, correct FIFO configuration

I used STM32CubeMX version 4.22 to generate MSC usb device and modified it to have 2 custom bulk interfaces. Interface 0 has 2 BULK endpoints IN and OUT. Interface 1 have two alternate settings. Alt Setting 0 has 0 endpoints and Alt Setting 1 have 2 BULK endpoints IN and OUT.
Endpoints are defined as :
define INTERFACE0_IN_EP 0x81
define INTERFACE0_OUT_EP 0x01
define INTERFACE1_IN_EP 0x82
define INTERFACE1_OUT_EP 0x02
My device enumerates fine and Interface 0 works as expected. Host sends Set Interface 1, Alt Setting 1 request then i activate Interface 1 endpoints (0x82 and 0x02).
Interface 1 is not working as expected, i am sure it has something to do with my FIFO Settings. I get dataOut Call for INTERFACE1_OUT_EP but when i try to write INTERFACE1_IN_EP host only get 3 bytes back while i am writing 24 bytes. Immediately after this transaction i get CLEAR FEATURE request for interface 1 endpoints.
Here is my current FIFO Settings :
HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0xC0); //80
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x40); //EP0
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80); //EP1
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 2, 0x40); //<-- If i don't add this line Host can not get any thing back, After adding this line host only receives 3 bytes on INTERFACE1_IN_EP.
Please help me to configure these FIFO settings properly so that second interface can also work as expected.
There are only 0x140 x 4(=1280bytes) available for USB FIFO in STM32.
But you used 0x180(=c0 + 40 + 80) x 4(=1536bytes).

BPF/Wincap filter not working in Pcap.net

I'm using a pcap.net process to broadcast out a packet, and listen in for a response. I want the response packets that it accepts to be a certain length. However, whenever I add a filter it only returns packets of length 100. Here's the code:
' Open the output device
Dim Communicator As PacketCommunicator = selectedOutputDevice.Open(100, PacketDeviceOpenAttributes.Promiscuous, 300)
Communicator.SetFilter("len >= 300")
' send broadcast packet
Communicator.SendPacket(BuildEthernetPacket(ReqInfoPkt, "ff:ff:ff:ff:ff:ff"))
' receive packets
While result = PacketCommunicatorReceiveResult.Ok And packetlist.Count < 500 And _
Not result = PacketCommunicatorReceiveResult.Timeout
result = Communicator.ReceivePacket(packet)
packetlist.Add(packet)
End While
Here's a link to the screen shot: link I tried asking on the pcap forums but didn't get a response.
So what am I doing wrong? Is there a synatx issue?
You open the device with the snapshot length set to 100 which means you cut all packets to be at most 100 bytes.
You should probably do
selectedOutputDevice.Open(65536, PacketDeviceOpenAttributes.Promiscuous, 300)
instead.
See the tutorial.