diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp index 26ba34a11aad..1c9b5c6c6d32 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp @@ -827,6 +827,13 @@ void MediaPipelineTransmit::PipelineListener::ProcessVideoChunk( return; } + // We get passed duplicate frames every ~10ms even if there's no frame change! + int32_t serial = img->GetSerial(); + if (serial == last_img_) { + return; + } + last_img_ = serial; + ImageFormat format = img->GetFormat(); #ifdef MOZ_WIDGET_GONK if (format == GONK_IO_SURFACE) { diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h index 46376227fbc6..52c3a312a90a 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h @@ -321,8 +321,12 @@ class MediaPipelineTransmit : public MediaPipeline { class PipelineListener : public MediaStreamListener { public: PipelineListener(const RefPtr& conduit) - : conduit_(conduit), active_(false), samples_10ms_buffer_(nullptr), - buffer_current_(0), samplenum_10ms_(0){} + : conduit_(conduit), + active_(false), + last_img_(-1), + samples_10ms_buffer_(nullptr), + buffer_current_(0), + samplenum_10ms_(0) {} ~PipelineListener() { @@ -359,6 +363,8 @@ class MediaPipelineTransmit : public MediaPipeline { RefPtr conduit_; volatile bool active_; + int32_t last_img_; // serial number of last Image + // These vars handle breaking audio samples into exact 10ms chunks: // The buffer of 10ms audio samples that we will send once full // (can be carried over from one call to another).