Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Bug related to the preview.

オープン
#1,689 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
15/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
android, kotlin

調査の方向性

Start with the reporter's surfaceCreated, surfaceChanged and surfaceDestroyed callbacks, which call prepareVideo, startStream, switchCamera, startPreview and stopPreview on RtspServerCamera2. The attached log file is not in the payload, so it must be fetched from the issue page. Done means identifying why the preview intermittently stays black on Android 11 and either fixing the lifecycle ordering or confirming it is a device issue, with a reproduction note.

索引モデルが issue の本文から書いたものです。

説明

Hi!

Could you please help me with an issue? I'm encountering an intermittent bug related to the preview.

About 3 out of 10 times, the preview shows a "black screen." I've attached the logs and code for reference.

Android 11
Hardware acceleration is enabled by default.


class RTSPFragment : Fragment(), ConnectChecker, ClientListener,
    SurfaceHolder.Callback {

    private lateinit var binding: FragmentRTSPBinding
    private lateinit var surfaceView: OpenGlView
    private lateinit var rtspServerCamera: RtspServerCamera2
    private var clickCount = 0

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        binding = FragmentRTSPBinding.inflate(inflater, container, false)
        return binding.root
    }

    @SuppressLint("SimpleDateFormat")
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        surfaceView = binding.surfaceViewCam2
        surfaceView.holder.addCallback(this)
        rtspServerCamera = RtspServerCamera2(surfaceView, this, 8554)
        rtspServerCamera.streamClient.setOnlyVideo(true)
        rtspServerCamera.streamClient.setClientListener(this)
        rtspServerCamera.streamClient.setAuthorization("admin", "admin")
        rtspServerCamera.setVideoCodec(VideoCodec.H264)
        surfaceView.setIsStreamHorizontalFlip(true)
        lifecycleScope.launch {
            try {
                while (true) {
                    binding.overlayTimeRtsp.text = SimpleDateFormat("HH:mm:ss").format(Date())
                    delay(500)
                }
            } catch (e: Exception) {
                e.printStackTrace()
            }
        }

        binding.logoCameraActivity.setOnClickListener{
            clickCount++
            if (clickCount >= 20) {
                findNavController().navigate(R.id.action_rtsp_to_login)
                clickCount = 0
            }
        }
    }

    private fun prepare(): Boolean {
        Log.d("CameraActivity", "prepare: front ${rtspServerCamera.resolutionsFront} back ${rtspServerCamera.resolutionsBack}")
        val prepared = rtspServerCamera.prepareVideo(1280, 720, 24, 2000 * 1024, 90)
        return prepared
    }

    override fun onAuthError() {
        Log.i("@@@@", "Auth error")
    }

    override fun onAuthSuccess() {
        Log.i("@@@@", "Auth success")
    }

    override fun onConnectionFailed(reason: String) {
        Log.i("@@@@", "Connection failed")
    }

    override fun onConnectionStarted(url: String) {
        Log.i("@@@@", "Connection started")
    }

    override fun onConnectionSuccess() {
        Log.i("@@@@", "Connection success")
    }

    override fun onDisconnect() {
        Log.i("@@@@", "Client disconnect")
    }

    override fun onClientConnected(client: ServerClient) {
        Log.i("@@@@", "Client connected")
    }

    override fun onClientDisconnected(client: ServerClient) {
        Log.i("@@@@", "Client disconnected")
    }

    override fun surfaceCreated(holder: SurfaceHolder) {
        if(prepare())
            rtspServerCamera.startStream()
        rtspServerCamera.switchCamera("0")
    }

    override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {
        if (!holder.surface.isValid)
            Log.e("@@@@", "Surface is invalid!")
        if (!rtspServerCamera.isOnPreview)
            rtspServerCamera.startPreview()
    }

    override fun surfaceDestroyed(holder: SurfaceHolder) {
        Log.i("@@@@", "Surface destroyed")
        if (rtspServerCamera.isStreaming) {
            rtspServerCamera.stopStream()
        }
        if (rtspServerCamera.isOnPreview)
            rtspServerCamera.stopPreview()
    }
}

18_12_24.txt

主要言語
Kotlin
スター
3k
フォーク
946
平均マージ
4日 6時間
マージ済み PR(30日)
9

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pedroSG94/RootEncoder のほかの issue

pedroSG94/RootEncoder の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。