Make the default ctor of rtc::Thread, protected.
The goal is to force use of Thread::Create or Thread::CreateWithSocketServer. The default constructor constructs a 'default' socket server, which is usually a 'physical' socket server, but not always. Not every instance of Thread actually needs to have network support, so it's better to have this be explicit instead of unknowingly instantiate one. BUG=none Review-Url: https://codereview.webrtc.org/2981623002 Cr-Commit-Position: refs/heads/master@{#19001}
This commit is contained in:
@ -55,7 +55,7 @@ namespace webrtc_jni {
|
||||
// Logging macros.
|
||||
#define TAG_DECODER "MediaCodecVideoDecoder"
|
||||
#ifdef TRACK_BUFFER_TIMING
|
||||
#define ALOGV(...)
|
||||
#define ALOGV(...) \
|
||||
__android_log_print(ANDROID_LOG_VERBOSE, TAG_DECODER, __VA_ARGS__)
|
||||
#else
|
||||
#define ALOGV(...)
|
||||
@ -180,24 +180,25 @@ class MediaCodecVideoDecoder : public webrtc::VideoDecoder,
|
||||
std::vector<jobject> input_buffers_;
|
||||
};
|
||||
|
||||
MediaCodecVideoDecoder::MediaCodecVideoDecoder(
|
||||
JNIEnv* jni, VideoCodecType codecType, jobject render_egl_context) :
|
||||
codecType_(codecType),
|
||||
render_egl_context_(render_egl_context),
|
||||
key_frame_required_(true),
|
||||
inited_(false),
|
||||
sw_fallback_required_(false),
|
||||
codec_thread_(new Thread()),
|
||||
j_media_codec_video_decoder_class_(
|
||||
jni,
|
||||
FindClass(jni, "org/webrtc/MediaCodecVideoDecoder")),
|
||||
j_media_codec_video_decoder_(
|
||||
jni,
|
||||
jni->NewObject(*j_media_codec_video_decoder_class_,
|
||||
GetMethodID(jni,
|
||||
*j_media_codec_video_decoder_class_,
|
||||
"<init>",
|
||||
"()V"))) {
|
||||
MediaCodecVideoDecoder::MediaCodecVideoDecoder(JNIEnv* jni,
|
||||
VideoCodecType codecType,
|
||||
jobject render_egl_context)
|
||||
: codecType_(codecType),
|
||||
render_egl_context_(render_egl_context),
|
||||
key_frame_required_(true),
|
||||
inited_(false),
|
||||
sw_fallback_required_(false),
|
||||
codec_thread_(Thread::Create()),
|
||||
j_media_codec_video_decoder_class_(
|
||||
jni,
|
||||
FindClass(jni, "org/webrtc/MediaCodecVideoDecoder")),
|
||||
j_media_codec_video_decoder_(
|
||||
jni,
|
||||
jni->NewObject(*j_media_codec_video_decoder_class_,
|
||||
GetMethodID(jni,
|
||||
*j_media_codec_video_decoder_class_,
|
||||
"<init>",
|
||||
"()V"))) {
|
||||
codec_thread_->SetName("MediaCodecVideoDecoder", NULL);
|
||||
RTC_CHECK(codec_thread_->Start()) << "Failed to start MediaCodecVideoDecoder";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user