Skip to content

Commit 72c6d26

Browse files
committed
VPLAY-11143: AAMP Mp4Demux Integration
Reason for change: Ensure coding guidelines are strictly followed. Code cleanup. Enforce encrypted caps are persisted when processing clear samples in between Test Procedure: As mentioned in the ticket Risks: None Signed-off-by: Vinish100 <[email protected]>
1 parent 439628e commit 72c6d26

16 files changed

+446
-413
lines changed

AampDemuxDataTypes.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ struct AampCodecInfo
8282
{
8383
std::memset(&mInfo, 0, sizeof(mInfo));
8484
}
85+
86+
AampCodecInfo(AampCodecInfo&& other) noexcept
87+
: mCodecFormat(other.mCodecFormat)
88+
, mCodecData(std::move(other.mCodecData))
89+
, mIsEncrypted(other.mIsEncrypted)
90+
, mInfo(other.mInfo)
91+
{
92+
// Reset the source object to default state
93+
other.mCodecFormat = FORMAT_INVALID;
94+
other.mIsEncrypted = false;
95+
std::memset(&other.mInfo, 0, sizeof(other.mInfo));
96+
// mCodecData is already empty after std::move
97+
}
8598
};
8699

87100
/*

ElementaryProcessor.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ bool ElementaryProcessor::setTuneTimePTS(char *segment, const size_t& size, doub
8383

8484
AAMPLOG_INFO("ElementaryProcessor:: sending segment at pos:%f dur:%f", position, duration);
8585

86-
// Logic for Audio Track
8786
// Wait for video to parse PTS
8887
std::unique_lock<std::mutex> guard(accessMutex);
8988

StreamAbstractionAAMP.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,8 +1993,6 @@ class StreamAbstractionAAMP : public AampLicenseFetcher
19931993
*/
19941994
void ReinitializeInjection(double rate);
19951995

1996-
virtual void GetStreamCodecInfo (AampCodecInfo &videoCodec, AampCodecInfo &audioCodec, AampCodecInfo &textCodec) { (void)videoCodec; (void)audioCodec; (void)textCodec; }
1997-
19981996
protected:
19991997
/**
20001998
* @brief Get stream information of a profile from subclass.

StreamOutputFormat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ enum StreamOutputFormat
3131
FORMAT_ISO_BMFF, /**< ISO Base Media File format */
3232
FORMAT_AUDIO_ES_MP3, /**< MP3 Audio Elementary Stream */
3333
FORMAT_AUDIO_ES_AAC, /**< AAC Audio Elementary Stream */
34+
FORMAT_AUDIO_ES_AAC_RAW,/**< AAC Raw Audio Elementary Stream */
3435
FORMAT_AUDIO_ES_AC3, /**< AC3 Audio Elementary Stream */
3536
FORMAT_AUDIO_ES_EC3, /**< Dolby Digital Plus Elementary Stream */
3637
FORMAT_AUDIO_ES_ATMOS, /**< ATMOS Audio stream */

fragmentcollector_mpd.cpp

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10483,17 +10483,23 @@ StreamOutputFormat GetSubtitleFormat(std::string mimeType)
1048310483
*/
1048410484
void StreamAbstractionAAMP_MPD::GetStreamFormat(StreamOutputFormat &primaryOutputFormat, StreamOutputFormat &audioOutputFormat, StreamOutputFormat &auxOutputFormat, StreamOutputFormat &subtitleOutputFormat)
1048510485
{
10486+
StreamOutputFormat format = FORMAT_ISO_BMFF; // Default format
10487+
if (ISCONFIGSET(eAAMPConfig_UseMp4Demux))
10488+
{
10489+
// Mp4Demuxer will set the format later once the init fragment is parsed
10490+
format = FORMAT_UNKNOWN;
10491+
}
1048610492
if(mMediaStreamContext[eMEDIATYPE_VIDEO] && mMediaStreamContext[eMEDIATYPE_VIDEO]->enabled )
1048710493
{
10488-
primaryOutputFormat = FORMAT_ISO_BMFF;
10494+
primaryOutputFormat = format;
1048910495
}
1049010496
else
1049110497
{
1049210498
primaryOutputFormat = FORMAT_INVALID;
1049310499
}
1049410500
if(mMediaStreamContext[eMEDIATYPE_AUDIO] && mMediaStreamContext[eMEDIATYPE_AUDIO]->enabled )
1049510501
{
10496-
audioOutputFormat = FORMAT_ISO_BMFF;
10502+
audioOutputFormat = format;
1049710503
}
1049810504
else
1049910505
{
@@ -10503,6 +10509,8 @@ void StreamAbstractionAAMP_MPD::GetStreamFormat(StreamOutputFormat &primaryOutpu
1050310509
if ((mMediaStreamContext[eMEDIATYPE_AUX_AUDIO] && mMediaStreamContext[eMEDIATYPE_AUX_AUDIO]->enabled) ||
1050410510
(mMediaStreamContext[eMEDIATYPE_SUBTITLE] && mMediaStreamContext[eMEDIATYPE_SUBTITLE]->enabled && mMediaStreamContext[eMEDIATYPE_SUBTITLE]->type == eTRACK_AUX_AUDIO))
1050510511
{
10512+
// Mp4Demuxer is not used in aux audio track as of now, so setting FORMAT_ISO_BMFF directly
10513+
// Aux audio to be deprecated soon
1050610514
auxOutputFormat = FORMAT_ISO_BMFF;
1050710515
}
1050810516
else
@@ -10533,6 +10541,7 @@ void StreamAbstractionAAMP_MPD::GetStreamFormat(StreamOutputFormat &primaryOutpu
1053310541
else
1053410542
{
1053510543
AAMPLOG_INFO("mimeType empty");
10544+
// Mp4Demux is skipped for subtitles
1053610545
subtitleOutputFormat = FORMAT_SUBTITLE_MP4;
1053710546
}
1053810547
}
@@ -14212,35 +14221,4 @@ bool StreamAbstractionAAMP_MPD::DoStreamSinkFlushOnDiscontinuity()
1421214221
void StreamAbstractionAAMP_MPD::clearFirstPTS(void)
1421314222
{
1421414223
mFirstPTS = 0.0;
14215-
}
14216-
14217-
void StreamAbstractionAAMP_MPD::GetStreamCodecInfo(AampCodecInfo &videoCodec, AampCodecInfo &audioCodec, AampCodecInfo &textCodec)
14218-
{
14219-
// Initialize with unknown format
14220-
videoCodec = AampCodecInfo(FORMAT_UNKNOWN);
14221-
audioCodec = AampCodecInfo(FORMAT_UNKNOWN);
14222-
textCodec = AampCodecInfo(FORMAT_UNKNOWN);
14223-
14224-
// Aux audio to be deprecated in future
14225-
for (const auto& mediaStreamContext : mMediaStreamContext)
14226-
{
14227-
// TODO: Optimize later
14228-
if (mediaStreamContext && mediaStreamContext->enabled && mediaStreamContext->playContext)
14229-
{
14230-
switch (mediaStreamContext->type)
14231-
{
14232-
case eTRACK_VIDEO:
14233-
videoCodec = mediaStreamContext->playContext->getCodecInfo();
14234-
break;
14235-
case eTRACK_AUDIO:
14236-
audioCodec = mediaStreamContext->playContext->getCodecInfo();
14237-
break;
14238-
case eTRACK_SUBTITLE:
14239-
textCodec = mediaStreamContext->playContext->getCodecInfo();
14240-
break;
14241-
default:
14242-
break;
14243-
}
14244-
}
14245-
}
1424614224
}

fragmentcollector_mpd.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,6 @@ class StreamAbstractionAAMP_MPD : public StreamAbstractionAAMP
528528
*/
529529
void clearFirstPTS(void) override;
530530

531-
void GetStreamCodecInfo (AampCodecInfo &videoCodec, AampCodecInfo &audioCodec, AampCodecInfo &textCodec) override;
532-
533531
protected:
534532
/**
535533
* @fn StartFromAampLocalTsb

isobmff/isobmffprocessor.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,6 @@ class IsoBmffProcessor : public MediaProcessor
490490
*/
491491
bool updatePTSAndTimeScaleFromBuffer(AampGrowableBuffer *pBuffer);
492492

493-
const AampCodecInfo& getCodecInfo() override { static AampCodecInfo info(FORMAT_ISO_BMFF); return info; };
494-
495493
PrivateInstanceAAMP *p_aamp;
496494
timeScaleChangeStateType timeScaleChangeState;
497495
MediaFormat mediaFormat;

mediaprocessor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,5 @@ class MediaProcessor
213213
* @brief Function to abort wait for videoPTS arrival
214214
*/
215215
virtual void abortWaitForVideoPTS() {}
216-
217-
/**
218-
* @brief Function to get codec information
219-
*/
220-
virtual const AampCodecInfo& getCodecInfo() { static AampCodecInfo info(FORMAT_UNKNOWN); return info; }
221216
};
222217
#endif /* __MEDIA_PROCESSOR_H__ */

middleware/GstUtils.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ GstCaps* GetCaps(GstStreamOutputFormat format)
5252
"mpegversion", G_TYPE_INT, 2,
5353
"stream-format", G_TYPE_STRING, "adts", NULL);
5454
break;
55+
case GST_FORMAT_AUDIO_ES_AAC_RAW:
56+
caps = gst_caps_new_simple ("audio/mpeg",
57+
"mpegversion", G_TYPE_INT, 4,
58+
"framed", G_TYPE_BOOLEAN, TRUE,
59+
"stream-format", G_TYPE_STRING, "raw", NULL);
60+
break;
5561
case GST_FORMAT_AUDIO_ES_AC3:
5662
caps = gst_caps_new_simple ("audio/x-ac3", NULL, NULL);
5763
break;

middleware/GstUtils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ enum GstStreamOutputFormat
6666
GST_FORMAT_ISO_BMFF, /**< ISO Base Media File format */
6767
GST_FORMAT_AUDIO_ES_MP3, /**< MP3 Audio Elementary Stream */
6868
GST_FORMAT_AUDIO_ES_AAC, /**< AAC Audio Elementary Stream */
69+
GST_FORMAT_AUDIO_ES_AAC_RAW,/**< AAC Raw Audio Elementary Stream */
6970
GST_FORMAT_AUDIO_ES_AC3, /**< AC3 Audio Elementary Stream */
7071
GST_FORMAT_AUDIO_ES_EC3, /**< Dolby Digital Plus Elementary Stream */
7172
GST_FORMAT_AUDIO_ES_ATMOS, /**< ATMOS Audio stream */

0 commit comments

Comments
 (0)