@@ -196,7 +196,7 @@ void MediaSampleProvider::InitializeStreamInfo()
196
196
delete[] channelLayoutName;
197
197
}
198
198
199
- streamInfo = AudioStreamInfo (
199
+ streamInfo = audioStreamInfo = AudioStreamInfo (
200
200
Name, Language, CodecName, (StreamDisposition)m_pAvStream->disposition , m_pAvStream->codecpar ->bit_rate , false ,
201
201
channels, channelLayout, m_pAvStream->codecpar ->sample_rate , bitsPerSample, Decoder (), StreamIndex ());
202
202
@@ -210,7 +210,7 @@ void MediaSampleProvider::InitializeStreamInfo()
210
210
auto bitsPerSample = max (m_pAvStream->codecpar ->bits_per_raw_sample , m_pAvStream->codecpar ->bits_per_coded_sample );
211
211
auto framesPerSecond = m_pAvStream->avg_frame_rate .num > 0 && m_pAvStream->avg_frame_rate .den > 0 ? av_q2d (m_pAvStream->avg_frame_rate ) : 0.0 ;
212
212
213
- streamInfo = VideoStreamInfo (Name, Language, CodecName, (StreamDisposition)m_pAvStream->disposition , m_pAvStream->codecpar ->bit_rate , false ,
213
+ streamInfo = videoStreamInfo = VideoStreamInfo (Name, Language, CodecName, (StreamDisposition)m_pAvStream->disposition , m_pAvStream->codecpar ->bit_rate , false ,
214
214
m_pAvStream->codecpar ->width , m_pAvStream->codecpar ->height , videoAspect,
215
215
bitsPerSample, framesPerSecond, HardwareAccelerationStatus (), Decoder (), StreamIndex ());
216
216
@@ -380,13 +380,24 @@ void MediaSampleProvider::EnableStream()
380
380
DebugMessage (L" EnableStream\n " );
381
381
m_isEnabled = true ;
382
382
m_pAvStream->discard = AVDISCARD_DEFAULT;
383
+
384
+ if (audioStreamInfo)
385
+ audioStreamInfo.as <implementation::AudioStreamInfo>()->SetIsActive (true );
386
+ if (videoStreamInfo)
387
+ videoStreamInfo.as <implementation::VideoStreamInfo>()->SetIsActive (true );
388
+
383
389
}
384
390
385
391
void MediaSampleProvider::DisableStream ()
386
392
{
387
393
DebugMessage (L" DisableStream\n " );
388
394
m_isEnabled = false ;
389
395
m_pAvStream->discard = AVDISCARD_ALL;
396
+
397
+ if (audioStreamInfo)
398
+ audioStreamInfo.as <implementation::AudioStreamInfo>()->SetIsActive (false );
399
+ if (videoStreamInfo)
400
+ videoStreamInfo.as <implementation::VideoStreamInfo>()->SetIsActive (false );
390
401
}
391
402
392
403
void MediaSampleProvider::SetCommonVideoEncodingProperties (VideoEncodingProperties const & videoProperties, bool isCompressedFormat)
@@ -481,6 +492,6 @@ void MediaSampleProvider::Detach()
481
492
482
493
void free_buffer (void * lpVoid)
483
494
{
484
- auto buffer = (AVBufferRef *)lpVoid;
495
+ auto buffer = (AVBufferRef*)lpVoid;
485
496
av_buffer_unref (&buffer);
486
497
}
0 commit comments