-
Notifications
You must be signed in to change notification settings - Fork 333
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
[Feature] Add AAC Support #1966
Open
niyatim23
wants to merge
11
commits into
develop-pre-1.11.0
Choose a base branch
from
aac-support
base: develop-pre-1.11.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a2d123a
Add RtpAacPayloader.c and RtpAacPayloader.h
869fe33
Add support for Aac in PeerConnection/SessionDescription
24e7a55
Add support for AAC in PeerConnection/PeerConnection
1ab5c81
Add support for AAC in PeerConnection/Rtp
4d6dba5
Add support for AAC in samples/kvsWebRTCClientMaster.c
19598b7
remove cmake flag
niyatim23 03398df
test + cleanup
niyatim23 c2c54f9
cleanup + fix the ci
niyatim23 92c94ef
clang format
niyatim23 650c9c9
fix windows build
niyatim23 2f21e35
add rfc
niyatim23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#define LOG_CLASS "RtpAacPayloader" | ||
|
||
#include "../../Include_i.h" | ||
|
||
STATUS createPayloadForAac(UINT32 mtu, PBYTE aacFrame, UINT32 aacFrameLength, PBYTE payloadBuffer, PUINT32 pPayloadLength, PUINT32 pPayloadSubLength, | ||
PUINT32 pPayloadSubLenSize) | ||
{ | ||
UNUSED_PARAM(mtu); | ||
ENTERS(); | ||
STATUS retStatus = STATUS_SUCCESS; | ||
UINT32 payloadLength = 0; | ||
UINT32 payloadSubLenSize = 0; | ||
BOOL sizeCalculationOnly = (payloadBuffer == NULL); | ||
|
||
CHK(aacFrame != NULL && pPayloadSubLenSize != NULL && pPayloadLength != NULL && (sizeCalculationOnly || pPayloadSubLength != NULL), | ||
STATUS_NULL_ARG); | ||
|
||
payloadLength = aacFrameLength; | ||
payloadSubLenSize = 1; | ||
|
||
// Only return size if given buffer is NULL | ||
CHK(!sizeCalculationOnly, retStatus); | ||
CHK(payloadLength <= *pPayloadLength && payloadSubLenSize <= *pPayloadSubLenSize, STATUS_BUFFER_TOO_SMALL); | ||
|
||
MEMCPY(payloadBuffer, aacFrame, aacFrameLength); | ||
pPayloadSubLength[0] = aacFrameLength; | ||
|
||
CleanUp: | ||
if (STATUS_FAILED(retStatus) && sizeCalculationOnly) { | ||
payloadLength = 0; | ||
payloadSubLenSize = 0; | ||
} | ||
|
||
if (pPayloadSubLenSize != NULL && pPayloadLength != NULL) { | ||
*pPayloadLength = payloadLength; | ||
*pPayloadSubLenSize = payloadSubLenSize; | ||
} | ||
|
||
LEAVES(); | ||
return retStatus; | ||
} | ||
|
||
STATUS depayAacFromRtpPayload(PBYTE pRawPacket, UINT32 packetLength, PBYTE pAacData, PUINT32 pAacLength, PBOOL pIsStart) | ||
{ | ||
ENTERS(); | ||
STATUS retStatus = STATUS_SUCCESS; | ||
UINT32 aacLength = 0; | ||
BOOL sizeCalculationOnly = (pAacData == NULL); | ||
|
||
CHK(pRawPacket != NULL && pAacLength != NULL, STATUS_NULL_ARG); | ||
CHK(packetLength > 0, retStatus); | ||
|
||
aacLength = packetLength; | ||
|
||
CHK(!sizeCalculationOnly, retStatus); | ||
CHK(aacLength <= *pAacLength, STATUS_BUFFER_TOO_SMALL); | ||
|
||
MEMCPY(pAacData, pRawPacket, aacLength); | ||
|
||
CleanUp: | ||
if (STATUS_FAILED(retStatus) && sizeCalculationOnly) { | ||
aacLength = 0; | ||
} | ||
|
||
if (pAacLength != NULL) { | ||
*pAacLength = aacLength; | ||
} | ||
|
||
if (pIsStart != NULL) { | ||
*pIsStart = TRUE; | ||
} | ||
|
||
LEAVES(); | ||
return retStatus; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/******************************************* | ||
AAC RTP Payloader include file | ||
*******************************************/ | ||
#ifndef __KINESIS_VIDEO_WEBRTC_CLIENT_RTPAACPAYLOADER_H | ||
#define __KINESIS_VIDEO_WEBRTC_CLIENT_RTPAACPAYLOADER_H | ||
|
||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
// https://www.rfc-editor.org/rfc/rfc6416 | ||
|
||
STATUS createPayloadForAac(UINT32, PBYTE, UINT32, PBYTE, PUINT32, PUINT32, PUINT32); | ||
STATUS depayAacFromRtpPayload(PBYTE, UINT32, PBYTE, PUINT32, PBOOL); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif //__KINESIS_VIDEO_WEBRTC_CLIENT_RTPAACPAYLOADER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably remove these hardcoded payload types altogether: https://issues.webrtc.org/issues/42231779
Not necessary for part of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're using it as a part of
setPayloadTypesForOffer
actually