wsygzyr / libjingle

Automatically exported from code.google.com/p/libjingle
0 stars 0 forks source link

How to request keyframes? #192

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When video calling with gmail, an IDR keyframe (NAL unit type 5) is received 
only once at start of the call. What mechanism should be used to request 
keyframes at a later point? This is needed if packets are missed at start of a 
call for instance.

Thanks!

Original issue reported on code.google.com by explorer...@gmail.com on 21 Jul 2011 at 7:54

GoogleCodeExporter commented 9 years ago
I think I have the same problem, I always get coded slice.

Original comment by interfac...@gmail.com on 22 Jul 2011 at 1:34

GoogleCodeExporter commented 9 years ago
I think it can be done by RTCP FIR messages. Take a look at 
http://tools.ietf.org/search/draft-ietf-avt-avpf-ccm-02#section-3.5 section 
4.3. However, I'm not sure if this is the correct mechanism to use. Wait for 
other answers too.

Original comment by diego.cd...@gmail.com on 22 Jul 2011 at 5:03

GoogleCodeExporter commented 9 years ago
Diego, have you successfully been able to use this mechanism to obtain type 5 
NALs after the initial connect?
If so, please share some code/insight into this.

I have tried using this mechanism but it hasn't worked for me so far. Maybe I 
am doing something wrong.

Original comment by explorer...@gmail.com on 23 Jul 2011 at 9:04

GoogleCodeExporter commented 9 years ago
I tried sending FIR, no luck, maybe we can buffer the start frames (NAL 7, 8, 
and 5 frame) for later use? Or my FIR format is not correct?

Original comment by interfac...@gmail.com on 25 Jul 2011 at 2:16

GoogleCodeExporter commented 9 years ago
I used the code below. It was implemented on RtpSenderReceiver. As I said, I 
don't know if it is the best approach. The RTCP struct is defined in the 
attached file. I hope it helps.

void RtpSenderReceiver::requestFIR()
{
    static unsigned short seqNo=0;    

    //FIR
    struct RTCPPacket packet;
    int len = sizeof(struct RTCPFixedHeader) + sizeof(struct FSB_FIRPacket) ;
    packet.setHeaderPadding(0);
    packet.setHeaderVersion(2);
    packet.setFmt(4);  // Request FIR
    packet.setType(RTCPPacket::tPSFB);
    packet.info.FSB_FIR.ssrc1 = ntohl(1);
    packet.info.FSB_FIR.ssrc2 = ntohl(0);
    packet.info.FSB_FIR.fci.sendr_ssrc = ntohl(senderSSRC);
    packet.info.FSB_FIR.fci.reserved = ntohl(seqNo++ << 24);
    packet.setLength(len);

    if(SendRtcpPacket((const void*)&packet, len))
           //OK
        else
           //NOT OK
}

bool RtpSenderReceiver::SendRtcpPacket(const void* data, size_t len)
{
    if (!media_channel_ || !media_channel_->network_interface())
    {
        return false;
    }

    talk_base::Buffer buffer(data, len);
    return media_channel_->network_interface()->SendRtcp(&buffer);
}

Original comment by diego.cd...@gmail.com on 26 Jul 2011 at 1:10

Attachments:

GoogleCodeExporter commented 9 years ago
Do you send single RTCP FIR packet?
One point, RTCP FIR should be sent along with RTCP Receiver Report(RR) or 
Sender Report(SR) packet.
I mean RTCP RR\SR + RTCP FIR
RR or SR may contain default values, no need to fill it with concrete data. For 
example GoogleTalk does not feel RR or SR packets. :)

The RTCP FIR feedback format I use, which is working fine, could be found in 
the table bellow.
 ---------------------------------------
|     Field    |  Value  | Size in bits |
|---------------------------------------|
|         RTCP Feedback fields          |
|---------------------------------------|
| Version      | 2       |  2           |
| Padding      | 0       |  1           |
| FMT          | 4       |  5           |
| Payload Type | 206     |  8           |
| Length       | Length  | 16           |
| sender SSRC  | 1       | 32           |
| media SSRC   | 0       | 32           |
|---------------------------------------|
|  Feedback Control Information fields  |
|---------------------------------------|
| SSRC         | SSRC*   | 32           |
| Seq. number  | Seq. N. |  8           |
| Reserved     | 0       | 24           |
 ---------------------------------------

SSRC* - in this field I put SSRC from the RTP packet header received from 
GoogleTalk.

I hope this will help.

Original comment by Alex.P.K...@gmail.com on 30 Jul 2011 at 6:04

GoogleCodeExporter commented 9 years ago
Hi Alex,

Thanks for the explanation. 

I tried sending an RR+FIR packet after setting the fields as you described in 
an FIR and RR packet  with RC=0  but I don't get back any NAL unit of type 5.

A few questions for you:

- When you say it is working fine for you, do you get back IDR pictures from 
gmail when you send this FIR or is there another indication?
- Do you send RR + FIR or do you also include SDES packets? The RFC says that 
SDES packets are also compulsory. In the RR packet, do you have RC field set to 
0?
- How often and when do you send this RR+FIR packet?
- Are you sending any other RTCP packets too?
- Are you sending and receiving video as single NAL unit packets or aggregated 
packets?

Thanks for your help.

Original comment by explorer...@gmail.com on 1 Aug 2011 at 7:48

GoogleCodeExporter commented 9 years ago
Does anyone have a working solution to this problem? Google, please help us 
here.

I have also tried sending RRs and SRs periodically in the hope that maybe 
Google talk wants to see SRs before it will accept FIR requests. But still no 
luck receiving IDR packets.

Original comment by explorer...@gmail.com on 3 Aug 2011 at 4:30

GoogleCodeExporter commented 9 years ago
I can't get the keyframe with NAL unit type 5 by send FIR packet. Any more 
suggestions?

Original comment by orzgames...@gmail.com on 12 Aug 2011 at 5:23

GoogleCodeExporter commented 9 years ago
Hi,

Is there any solution for this topic? Sending FIR packet did not work for me.

Original comment by mdna...@gmail.com on 10 Apr 2012 at 12:58

GoogleCodeExporter commented 9 years ago

Original comment by juberti@google.com on 31 May 2013 at 4:26

GoogleCodeExporter commented 9 years ago
Why did this post get marked as 'wontfix'? Any reasoning behind it?

Original comment by ke...@hadm.net on 17 Jun 2013 at 9:29