HÙNG PHẠM
HÙNG PHẠM

Reputation: 11

WebRTC P2P Stream video switching corrupted image

I'm working with WebRTC P2P video streaming on 2 channel FullHD and HD between my camera and web simple. The issue occurs when I switched from channel HD to channel FullHD and vice versa, the video image has corrupted or has a green screen in a moment, after that the stream runs normally. I try to send I-Frame each times I switch between 2 channel but it still has a issue above. Do I need send something to reset the video for the decoder ?

This is my simple code show my flow:

int bChannelSelected = 0;

// Get video encode  channel HD
void GetVENCChannelHD() {
    if (bChannelSelected == 0) {
        // Send I-Frames of sample HD
        // Send samples HD to clients
    }
}

// Get video encode  channel FullHD
void GetVENCChannelFullHD() {
    if (bChannelSelected == 1) {
        // Send I-Frames of sample FullHD
        // Send samples FullHD to clients
    }
}

void setChannelSelected(int channel) {
    bChannelSelected = channel;
} 

I have to try send I-Frame each time I change to another channel, but it still have a green screen in a moment

Upvotes: 1

Views: 50

Answers (0)

Related Questions