mirror of
https://github.com/thinkonmay/sunshine-sdk.git
synced 2026-08-07 02:41:54 +00:00
audio - video reset event
This commit is contained in:
parent
d1cd872b39
commit
16d647c3e8
@ -151,6 +151,7 @@ void encodeThread(safe::mail_t mail, sample_queue_t samples, config_t config, vo
|
||||
|
||||
void capture(safe::mail_t mail, config_t config, void *channel_data) {
|
||||
auto shutdown_event = mail->event<bool>(mail::shutdown);
|
||||
auto audio_reset_events = mail->event<bool>(mail::audio_reset);
|
||||
auto stream = &stream_configs[map_stream(config.channels, config.flags[config_t::HIGH_QUALITY])];
|
||||
|
||||
auto ref = control_shared.ref();
|
||||
@ -237,6 +238,11 @@ void capture(safe::mail_t mail, config_t config, void *channel_data) {
|
||||
sample_buffer.resize(samples_per_frame);
|
||||
|
||||
auto status = mic->sample(sample_buffer);
|
||||
if (audio_reset_events->peek()) {
|
||||
audio_reset_events->pop();
|
||||
status = platf::capture_e::reinit;
|
||||
}
|
||||
|
||||
switch (status) {
|
||||
case platf::capture_e::ok:
|
||||
break;
|
||||
|
||||
@ -23,6 +23,8 @@ MAIL(audio_packets);
|
||||
MAIL(bitrate);
|
||||
MAIL(framerate);
|
||||
MAIL(resolution);
|
||||
MAIL(video_reset);
|
||||
MAIL(audio_reset);
|
||||
|
||||
// Local mail
|
||||
MAIL(idr);
|
||||
|
||||
12
src/main.cpp
12
src/main.cpp
@ -44,6 +44,8 @@ enum EventType {
|
||||
BufferOverflow,
|
||||
Resolution,
|
||||
Reset,
|
||||
VideoReset,
|
||||
AudioReset,
|
||||
EventMax
|
||||
};
|
||||
|
||||
@ -223,6 +225,8 @@ int main(int argc, char *argv[]) {
|
||||
auto framerate = mail->event<int>(mail::framerate);
|
||||
auto idr = mail->event<bool>(mail::idr);
|
||||
auto resolution = mail->event<std::pair<int, int>>(mail::resolution);
|
||||
auto video_reset = mail->event<bool>(mail::video_reset);
|
||||
auto audio_reset = mail->event<bool>(mail::audio_reset);
|
||||
|
||||
int cached_bitrate = 6000; // kbps, matches default config.bitrate
|
||||
int new_framerate;
|
||||
@ -277,6 +281,14 @@ int main(int argc, char *argv[]) {
|
||||
BOOST_LOG(info) << "Pipeline reset requested";
|
||||
process_shutdown_event->raise(true);
|
||||
break;
|
||||
case EventType::VideoReset:
|
||||
BOOST_LOG(info) << "Video pipeline reset requested";
|
||||
video_reset->raise(true);
|
||||
break;
|
||||
case EventType::AudioReset:
|
||||
BOOST_LOG(info) << "Audio pipeline reset requested";
|
||||
audio_reset->raise(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1703,6 +1703,7 @@ void encode_run(int &frame_nr, // Store progress of the frame number
|
||||
|
||||
auto shutdown_event = mail->event<bool>(mail::shutdown);
|
||||
auto bitrate_events = mail->event<int>(mail::bitrate);
|
||||
auto video_reset_events = mail->event<bool>(mail::video_reset);
|
||||
auto framerate_events = mail->event<int>(mail::framerate);
|
||||
auto packets = mail->queue<packet_t>(mail::video_packets);
|
||||
auto idr_events = mail->event<bool>(mail::idr);
|
||||
@ -1736,8 +1737,9 @@ void encode_run(int &frame_nr, // Store progress of the frame number
|
||||
if (shutdown_event->peek()) {
|
||||
break;
|
||||
}
|
||||
if (reinit_event.peek()) {
|
||||
BOOST_LOG(info) << "Video encode loop pausing for display reinit"sv;
|
||||
if (reinit_event.peek() || video_reset_events->peek()) {
|
||||
BOOST_LOG(info) << "Video encode loop pausing for display reinit or reset"sv;
|
||||
video_reset_events->pop();
|
||||
break;
|
||||
}
|
||||
if (!images->running()) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user