Merge pull request #5388 from kepstin/webrtc-webcams

Include WebRTC webcams in processed recordings
This commit is contained in:
Fred Dixon 2018-04-24 16:55:34 -04:00 committed by GitHub
commit 7cf9ae659f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 97 deletions

View File

@ -106,17 +106,6 @@ module BigBlueButton
start_events
end
# Get stop video events
def self.get_stop_video_events(events_xml)
BigBlueButton.logger.info("Task: Getting stop video events")
stop_events = []
doc = Nokogiri::XML(File.open(events_xml))
doc.xpath("//event[@eventname='StopWebcamShareEvent']").each do |stop_event|
stop_events << {:stop_timestamp => stop_event['timestamp'].to_i, :stream => stop_event.xpath('stream').text}
end
stop_events
end
# Build a webcam EDL
def self.create_webcam_edl(archive_dir)
events = Nokogiri::XML(File.open("#{archive_dir}/events.xml"))
@ -139,13 +128,22 @@ module BigBlueButton
:areas => { :webcam => [] }
}
events.xpath('/recording/event[@module="WEBCAM"]').each do |event|
events.xpath('/recording/event[@module="WEBCAM" or @module="bbb-webrtc-sfu"]').each do |event|
timestamp = event['timestamp'].to_i - initial_timestamp
# Determine the video filename
case event['eventname']
when 'StartWebcamShareEvent'
when 'StartWebcamShareEvent', 'StopWebcamShareEvent'
stream = event.at_xpath('stream').text
filename = "#{video_dir}/#{stream}.flv"
when 'StartWebRTCShareEvent', 'StopWebRTCShareEvent'
uri = event.at_xpath('filename').text
filename = "#{video_dir}/#{File.basename(uri)}"
end
raise "Couldn't determine webcam filename" if filename.nil?
# Add the video to the EDL
case event['eventname']
when 'StartWebcamShareEvent', 'StartWebRTCShareEvent'
videos[filename] = { :timestamp => timestamp }
active_videos << filename
@ -160,10 +158,7 @@ module BigBlueButton
}
end
video_edl << edl_entry
when 'StopWebcamShareEvent'
stream = event.at_xpath('stream').text
filename = "#{video_dir}/#{stream}.flv"
when 'StopWebcamShareEvent', 'StopWebRTCShareEvent'
active_videos.delete(filename)
edl_entry = {
@ -494,7 +489,7 @@ module BigBlueButton
# of the final recording
def self.have_webcam_events(events_xml)
BigBlueButton.logger.debug("Checking if webcams were used...")
webcam_events = events_xml.xpath('/recording/event[@module="WEBCAM"]')
webcam_events = events_xml.xpath('/recording/event[@eventname="StartWebcamShareEvent" or @eventname="StartWebRTCShareEvent"]')
if webcam_events.length > 0
BigBlueButton.logger.debug("Webcam events seen in recording")
return true

View File

@ -127,6 +127,7 @@ redis_host = props['redis_host']
redis_port = props['redis_port']
presentation_dir = props['raw_presentation_src']
video_dir = props['raw_video_src']
kurento_video_dir = props['kurento_video_src']
log_dir = props['log_dir']
BigBlueButton.logger = Logger.new("#{log_dir}/archive-#{meeting_id}.log", 'daily' )
@ -140,6 +141,7 @@ if not FileTest.directory?(target_dir)
archive_deskshare(meeting_id, deskshare_dir, raw_archive_dir)
archive_screenshare(meeting_id, screenshare_dir, raw_archive_dir)
archive_video(meeting_id, video_dir, raw_archive_dir)
archive_video(meeting_id, kurento_video_dir, raw_archive_dir)
if not archive_has_recording_marks?(meeting_id, raw_archive_dir)
BigBlueButton.logger.info("There's no recording marks for #{meeting_id}, not processing recording.")

View File

@ -1,6 +1,7 @@
bbb_version: '2.0.0'
raw_audio_src: /var/freeswitch/meetings
raw_video_src: /usr/share/red5/webapps/video/streams
kurento_video_src: /var/kurento/recordings
raw_screenshare_src: /usr/share/red5/webapps/screenshare/streams
raw_webrtc_deskshare_src: /usr/share/red5/webapps/video-broadcast/streams
raw_deskshare_src: /var/bigbluebutton/deskshare

View File

@ -1,79 +0,0 @@
#
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
#
# Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
#
# This program is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free Software
# Foundation; either version 3.0 of the License, or (at your option) any later
# version.
#
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
#
require 'spec_helper'
require 'digest/md5'
module BigBlueButton
describe "DeskshareProcessing" do
context "#success" do
it "should get the 2 webcam start events" do
dir = "resources/raw"
events_xml = "#{dir}/webcam-events.xml"
se = BigBlueButton::Events.get_start_video_events(events_xml)
se.size.should == 2
end
it "should get the 2 webcam stop events" do
dir = "resources/raw"
events_xml = "#{dir}/webcam-events.xml"
se = BigBlueButton::Events.get_stop_video_events(events_xml)
se.size.should == 2
end
it "should get the 2 deskshare start events" do
dir = "resources/raw/974a4b8c-5bf7-4382-b4cd-eb26af7dfcc2"
events_xml = "#{dir}/events.xml"
BigBlueButton::Events.get_start_deskshare_events(events_xml).size.should == 2
end
it "should get the 2 deskshare stop events" do
dir = "resources/raw/974a4b8c-5bf7-4382-b4cd-eb26af7dfcc2"
events_xml = "#{dir}/events.xml"
BigBlueButton::Events.get_stop_deskshare_events(events_xml).size.should == 2
end
it "should get the webcam start events" do
dir = "resources/raw"
events_xml = "#{dir}/webcam-events.xml"
se = BigBlueButton::Events.get_start_video_events(events_xml)
se.size.should == 2
end
it "should get the webcam stop events" do
dir = "resources/raw"
events_xml = "#{dir}/webcam-events.xml"
se = BigBlueButton::Events.get_stop_video_events(events_xml)
se.size.should == 2
end
it "should get the deskshare start events" do
dir = "resources/raw/8774263b-c4a6-4078-b2e6-46b7d4bc91c1"
events_xml = "#{dir}/events.xml"
BigBlueButton::Events.get_start_deskshare_events(events_xml).size.should == 1
end
it "should get the deskshare stop events" do
dir = "resources/raw/8774263b-c4a6-4078-b2e6-46b7d4bc91c1"
events_xml = "#{dir}/events.xml"
BigBlueButton::Events.get_stop_deskshare_events(events_xml).size.should == 1
end
end
end
end