cancel
Showing results for 
Search instead for 
Did you mean: 

409 when codec changed

cjp
Community Member

I am trying to use the Nest APIs to connect. I have gotten all the auth token stuff working. I have created an offer and gotten an answer but the data does not flow. I realized I was not asking for the H264 codec in my offer so I just changed that. Now every time this is the response I get from the API:

 

```

{
"error": {
"code"409,
"message""Failed to retrieve answer SDP due to timeout, please try again.",
"status""ABORTED"
}
}
```
 
It's very suspicious that this aborted error happens when I ask for the correct codec... is it hitting some kind of bottleneck? The Error code is under-documented... there's no entry for it.. but 4xx errors are typically requester problems, if it was a server side thing I'd expect 5xx, but of course timeout implies try again. (I have tried and waited many times.)
 
The Camera itself works in Home app and it works in the google developer sample webapp with browser-based SDP. I am trying headless SDP with the pion webrtc library.
1 Recommended Answer

cjp
Community Member

In case anyone comes upon this I have resolved this issue: 

In pion it was solved by calling m.RegisterDefaultCodecs() instead of sending a few codecs in as the save-to-disk sample does. 

In general it appears that the google API will fail with multiple strange errors if it doesn't like the codec (409, 500). More frustrating is that if it will sometimes appear to succeed with some codecs but then just silent fail and not send data. Sending the full barrage of codecs solved that for now.

View Recommended Answer in original post

4 REPLIES 4

cjp
Community Member

In case anyone comes upon this I have resolved this issue: 

In pion it was solved by calling m.RegisterDefaultCodecs() instead of sending a few codecs in as the save-to-disk sample does. 

In general it appears that the google API will fail with multiple strange errors if it doesn't like the codec (409, 500). More frustrating is that if it will sometimes appear to succeed with some codecs but then just silent fail and not send data. Sending the full barrage of codecs solved that for now.

sipriyadarshi
Solutions Expert
Solutions Expert

We are glad that you were able to resolve the issue. We do have a document in regard to camerastream trait. Also, we do have a list of what audio and video codecs we support and many more information that can be found in this document.

Thank you for replying. I don't understand how to fit the camerastream trait page you linked into the framework. Is this a command that can be sent with the devices/{DEVICE_ID}:executeCommand API call?

Also why does the API respond with an apparent "accept" SDP string but then fail to send data if the codec mix is not its liking? It seems like the GenerateWebRtcStream is the place to show logical failure to accept? 

maymun
Solutions Expert
Solutions Expert

There are two set of APIs for Home Controls within Google. Smart Home API for Cameras allows you to connect 3p cameras to Google Home ecosystem and provide controls through Google Home App and Google Assistant. Device Access APIs for Cameras allows you to control 1p Google Nest Cameras through external systems.

Both APIs support WebRTC and SDP exchange is documented. I think you are working with the Device Access APIs, but above answer was with Smart Home APIs. Sorry for the confusion.