Skip to content

Commit 9608aa7

Browse files
authored
Set discard flag on all unselected streams (#166)
Set discard flag on all unselected streams
2 parents 38898ee + 6c4c0c8 commit 9608aa7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

FFmpegInterop/FFmpegInteropMSS.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,8 @@ HRESULT FFmpegInteropMSS::InitFFmpegContext()
783783
for (unsigned int index = 0; index < avFormatCtx->nb_streams; index++)
784784
{
785785
auto avStream = avFormatCtx->streams[index];
786+
avStream->discard = AVDISCARD_ALL; // all streams are disabled until we enable them
787+
786788
MediaSampleProvider^ stream;
787789

788790
if (avStream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !config->IsFrameGrabber && !config->IsExternalSubtitleParser)

FFmpegInterop/MediaSampleProvider.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,15 @@ void MediaSampleProvider::EnableStream()
301301
{
302302
DebugMessage(L"EnableStream\n");
303303
m_isEnabled = true;
304+
m_pAvStream->discard = AVDISCARD_DEFAULT;
304305
}
305306

306307
void MediaSampleProvider::DisableStream()
307308
{
308309
DebugMessage(L"DisableStream\n");
309310
Flush();
310311
m_isEnabled = false;
312+
m_pAvStream->discard = AVDISCARD_ALL;
311313
}
312314

313315
void MediaSampleProvider::SetCommonVideoEncodingProperties(VideoEncodingProperties^ videoProperties, bool isCompressedFormat)

0 commit comments

Comments
 (0)