Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NCG-5940: added interface for call recording #1

Open
wants to merge 14 commits into
base: M123
Choose a base branch
from
11 changes: 11 additions & 0 deletions modules/audio_device/audio_device_generic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,15 @@ int AudioDeviceGeneric::GetRecordAudioParameters(
}
#endif // WEBRTC_IOS

// MARK: Nicegram NCG-5828 call recording

void AudioDeviceGeneric::StartNicegramRecording(const CompletionRecorderCallback& callback, const RecorderErrorCallback &errorCallback) {
RTC_LOG_F(LS_ERROR) << "Not supported on this platform";
}

void AudioDeviceGeneric::StopNicegramRecording(bool synchronous) {
RTC_LOG_F(LS_ERROR) << "Not supported on this platform";
}
//

} // namespace webrtc
12 changes: 12 additions & 0 deletions modules/audio_device/audio_device_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ namespace webrtc {

class AudioDeviceGeneric {
public:
// MARK: Nicegram NCG-5828 call recording
using CompletionRecorderCallback = std::function<void(const std::string& outputFilePath,
double durationInSeconds,
size_t rawDataSize)>;

using RecorderErrorCallback = std::function<void(const std::string& error)>;
//
// For use with UMA logging. Must be kept in sync with histograms.xml in
// Chrome, located at
// https://cs.chromium.org/chromium/src/tools/metrics/histograms/histograms.xml
Expand Down Expand Up @@ -135,6 +142,11 @@ class AudioDeviceGeneric {
virtual int GetRecordAudioParameters(AudioParameters* params) const;
#endif // WEBRTC_IOS

// MARK: Nicegram NCG-5828 call recording
virtual void StartNicegramRecording(const CompletionRecorderCallback& callback, const RecorderErrorCallback &errorCallback);
virtual void StopNicegramRecording(bool synchronous = false);
//

virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) = 0;

virtual ~AudioDeviceGeneric() {}
Expand Down
12 changes: 12 additions & 0 deletions modules/audio_device/include/audio_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ class AudioDeviceModuleForTest;

class AudioDeviceModule : public webrtc::RefCountInterface {
public:
// MARK: Nicegram NCG-5828 call recording
using CompletionRecorderCallback = std::function<void(const std::string& outputFilePath,
double durationInSeconds,
size_t rawDataSize)>;

using RecorderErrorCallback = std::function<void(const std::string& error)>;
//
enum AudioLayer {
kPlatformDefaultAudio = 0,
kWindowsCoreAudio,
Expand Down Expand Up @@ -171,6 +178,11 @@ class AudioDeviceModule : public webrtc::RefCountInterface {
virtual int GetRecordAudioParameters(AudioParameters* params) const = 0;
#endif // WEBRTC_IOS

// MARK: Nicegram NCG-5828 call recording
virtual void StartNicegramRecording(const CompletionRecorderCallback& callback, const RecorderErrorCallback &errorCallback) {}
virtual void StopNicegramRecording(bool synchronous = false) {}
//

protected:
~AudioDeviceModule() override {}
};
Expand Down
2 changes: 1 addition & 1 deletion modules/video_coding/codecs/h264/h264.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ bool H264Encoder::SupportsScalabilityMode(ScalabilityMode scalability_mode) {

std::unique_ptr<H264Decoder> H264Decoder::Create() {
RTC_DCHECK(H264Decoder::IsSupported());
#if defined(WEBRTC_USE_H264)
#if defined(WEBRTC_USE_H264) && defined(WEBRTC_USE_H264_DECODER)
RTC_CHECK(g_rtc_use_h264);
RTC_LOG(LS_INFO) << "Creating H264DecoderImpl.";
return std::make_unique<H264DecoderImpl>();
Expand Down
2 changes: 2 additions & 0 deletions modules/video_coding/codecs/h264/h264_decoder_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// build with H264 support, please do not move anything out of the
// #ifdef unless needed and tested.
#ifdef WEBRTC_USE_H264
#ifdef WEBRTC_USE_H264_DECODER

#include "modules/video_coding/codecs/h264/h264_decoder_impl.h"

Expand Down Expand Up @@ -658,4 +659,5 @@ void H264DecoderImpl::ReportError() {

} // namespace webrtc

#endif // WEBRTC_USE_H264_DECODER
#endif // WEBRTC_USE_H264
2 changes: 2 additions & 0 deletions modules/video_coding/codecs/h264/h264_decoder_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// build with H264 support, please do not move anything out of the
// #ifdef unless needed and tested.
#ifdef WEBRTC_USE_H264
#ifdef WEBRTC_USE_H264_DECODER

#if defined(WEBRTC_WIN) && !defined(__clang__)
#error "See: bugs.webrtc.org/9213#c13."
Expand Down Expand Up @@ -104,6 +105,7 @@ class H264DecoderImpl : public H264Decoder {

} // namespace webrtc

#endif // WEBRTC_USE_H264_DECODER
#endif // WEBRTC_USE_H264

#endif // MODULES_VIDEO_CODING_CODECS_H264_H264_DECODER_IMPL_H_
2 changes: 1 addition & 1 deletion video/rtp_video_stream_receiver2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
}

// Only construct the encrypted receiver if frame encryption is enabled.
if (config_.crypto_options.sframe.require_frame_encryption) {
if (config_.crypto_options.sframe.require_frame_encryption || frame_decryptor) {
buffered_frame_decryptor_ =
std::make_unique<BufferedFrameDecryptor>(this, this, field_trials_);
if (frame_decryptor != nullptr) {
Expand Down