Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
J
jami-daemon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
130
Issues
130
List
Boards
Labels
Service Desk
Milestones
Iterations
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
savoirfairelinux
jami-daemon
Commits
ecf9650a
Commit
ecf9650a
authored
Oct 19, 2018
by
Philippe Gorley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
localrecorder: simplify setup
Change-Id: I951cc45a6dda6c13c10e2dedb41fb2d19e8b0206
parent
a031c92d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
36 deletions
+28
-36
src/client/videomanager.cpp
src/client/videomanager.cpp
+1
-9
src/media/localrecorder.cpp
src/media/localrecorder.cpp
+13
-19
src/media/localrecorder.h
src/media/localrecorder.h
+8
-6
src/media/video/video_input.cpp
src/media/video/video_input.cpp
+6
-2
No files found.
src/client/videomanager.cpp
View file @
ecf9650a
...
@@ -278,15 +278,7 @@ startLocalRecorder(const bool& audioOnly, const std::string& filepath)
...
@@ -278,15 +278,7 @@ startLocalRecorder(const bool& audioOnly, const std::string& filepath)
return
""
;
return
""
;
}
}
std
::
unique_ptr
<
ring
::
LocalRecorder
>
rec
;
auto
rec
=
std
::
make_unique
<
ring
::
LocalRecorder
>
(
audioOnly
);
std
::
shared_ptr
<
ring
::
video
::
VideoInput
>
input
=
nullptr
;
if
(
!
audioOnly
)
{
input
=
std
::
static_pointer_cast
<
ring
::
video
::
VideoInput
>
(
ring
::
getVideoCamera
());
}
/* in case of audio-only recording, nullptr is passed and LocalRecorder will
assume isAudioOnly_ = true, so no need to call Recordable::isAudioOnly(). */
rec
.
reset
(
new
ring
::
LocalRecorder
(
input
));
rec
->
setPath
(
filepath
);
rec
->
setPath
(
filepath
);
// retrieve final path (containing file extension)
// retrieve final path (containing file extension)
...
...
src/media/localrecorder.cpp
View file @
ecf9650a
...
@@ -22,21 +22,16 @@
...
@@ -22,21 +22,16 @@
#include "localrecorder.h"
#include "localrecorder.h"
#include "audio/ringbufferpool.h"
#include "audio/ringbufferpool.h"
#include "audio/ringbuffer.h"
#include "audio/ringbuffer.h"
#include "client/videomanager.h"
#include "media_stream.h"
#include "media_stream.h"
#include "manager.h"
#include "manager.h"
#include "logger.h"
#include "logger.h"
namespace
ring
{
namespace
ring
{
LocalRecorder
::
LocalRecorder
(
std
::
shared_ptr
<
ring
::
video
::
VideoInput
>
input
)
{
LocalRecorder
::
LocalRecorder
(
const
bool
&
audioOnly
)
{
if
(
input
)
{
isAudioOnly_
=
audioOnly
;
videoInput_
=
input
;
recorder_
->
audioOnly
(
audioOnly
);
videoInputSet_
=
true
;
}
else
{
isAudioOnly_
=
true
;
}
recorder_
->
audioOnly
(
isAudioOnly_
);
}
}
void
void
...
@@ -81,11 +76,11 @@ LocalRecorder::startRecording()
...
@@ -81,11 +76,11 @@ LocalRecorder::startRecording()
#ifdef RING_VIDEO
#ifdef RING_VIDEO
// video recording
// video recording
if
(
!
isAudioOnly_
)
{
if
(
!
isAudioOnly_
)
{
if
(
videoInputSet_
)
{
videoInput_
=
std
::
static_pointer_cast
<
video
::
VideoInput
>
(
ring
::
getVideoCamera
());
auto
videoInputShpnt
=
videoInput_
.
lock
();
if
(
videoInput_
)
{
videoInput
Shpnt
->
initRecorder
(
recorder_
);
videoInput
_
->
initRecorder
(
recorder_
);
}
else
{
}
else
{
RING_ERR
(
"[BUG] can't record video (video input pointer is null)"
)
;
RING_ERR
(
)
<<
"Unable to record video (no video input)"
;
return
false
;
return
false
;
}
}
}
}
...
@@ -98,12 +93,11 @@ void
...
@@ -98,12 +93,11 @@ void
LocalRecorder
::
stopRecording
()
LocalRecorder
::
stopRecording
()
{
{
Recordable
::
stopRecording
();
Recordable
::
stopRecording
();
Manager
::
instance
().
getRingBufferPool
().
unBindHalfDuplexOut
(
path_
,
RingBufferPool
::
DEFAULT_ID
);
if
(
audioInput_
)
{
audioInput_
.
reset
();
Manager
::
instance
().
getRingBufferPool
().
unBindHalfDuplexOut
(
path_
,
RingBufferPool
::
DEFAULT_ID
);
if
(
videoInput_
)
}
else
{
videoInput_
->
initRecorder
(
nullptr
);
// workaround for deiniting recorder
RING_ERR
(
"could not stop audio layer (audio input is null)"
);
videoInput_
.
reset
();
}
}
}
}
// namespace ring
}
// namespace ring
src/media/localrecorder.h
View file @
ecf9650a
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
* Copyright (C) 2018 Savoir-faire Linux Inc.
* Copyright (C) 2018 Savoir-faire Linux Inc.
*
*
* Author: Hugo Lefeuvre <hugo.lefeuvre@savoirfairelinux.com>
* Author: Hugo Lefeuvre <hugo.lefeuvre@savoirfairelinux.com>
* Author: Philippe Gorley <philippe.gorley@savoirfairelinux.com>
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
...
@@ -20,9 +21,9 @@
...
@@ -20,9 +21,9 @@
#pragma once
#pragma once
#include "media/video/video_input.h"
#include "audio/audio_input.h"
#include "media/audio/audio_input.h"
#include "recordable.h"
#include "recordable.h"
#include "video/video_input.h"
namespace
ring
{
namespace
ring
{
...
@@ -45,7 +46,7 @@ class LocalRecorder : public Recordable {
...
@@ -45,7 +46,7 @@ class LocalRecorder : public Recordable {
* If input pointer in null, video recording will be disabled on this
* If input pointer in null, video recording will be disabled on this
* recorder.
* recorder.
*/
*/
LocalRecorder
(
std
::
shared_ptr
<
ring
::
video
::
VideoInput
>
input
);
LocalRecorder
(
const
bool
&
audioOnly
);
/**
/**
* Start local recording. Return true if recording was successfully
* Start local recording. Return true if recording was successfully
...
@@ -61,10 +62,11 @@ class LocalRecorder : public Recordable {
...
@@ -61,10 +62,11 @@ class LocalRecorder : public Recordable {
void
setPath
(
const
std
::
string
&
path
);
void
setPath
(
const
std
::
string
&
path
);
private:
private:
bool
videoInputSet_
=
false
;
std
::
weak_ptr
<
ring
::
video
::
VideoInput
>
videoInput_
;
std
::
unique_ptr
<
ring
::
AudioInput
>
audioInput_
=
nullptr
;
std
::
string
path_
;
std
::
string
path_
;
// media inputs
std
::
shared_ptr
<
ring
::
video
::
VideoInput
>
videoInput_
;
std
::
unique_ptr
<
ring
::
AudioInput
>
audioInput_
;
};
};
}
// namespace ring
}
// namespace ring
src/media/video/video_input.cpp
View file @
ecf9650a
...
@@ -625,8 +625,12 @@ VideoInput::foundDecOpts(const DeviceParams& params)
...
@@ -625,8 +625,12 @@ VideoInput::foundDecOpts(const DeviceParams& params)
void
void
VideoInput
::
initRecorder
(
const
std
::
shared_ptr
<
MediaRecorder
>&
rec
)
VideoInput
::
initRecorder
(
const
std
::
shared_ptr
<
MediaRecorder
>&
rec
)
{
{
recorder_
=
rec
;
if
(
rec
)
{
rec
->
incrementExpectedStreams
(
1
);
recorder_
=
rec
;
rec
->
incrementExpectedStreams
(
1
);
}
else
{
recorder_
.
reset
();
}
}
}
}}
// namespace ring::video
}}
// namespace ring::video
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment