小编Kev*_*n K的帖子

调整android中视频显示中宽高比变化的表面视图大小

我正在开展视频会议项目.我的视频显示使用表面视图.现在,在视频通话期间,传入帧的宽高比可能会发生变化.所以我尝试了以下代码

public void surfaceResize() {

   // WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Point size = new Point();
    int screenWidth = 0;
    //Get the SurfaceView layout parameters

    float aspectRatio = (float) recv_frame_width / recv_frame_height;

    if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) 
    {   
        //Get the width of the screen
        getWindowManager().getDefaultDisplay().getSize(size);
        screenWidth = size.x;

        //Set the width of the SurfaceView to the width of the screen
        surflp.width = screenWidth;

        //Set the height of the SurfaceView to match the aspect ratio of the video 
        //be sure to cast these …
Run Code Online (Sandbox Code Playgroud)

video android surfaceview mediacodec

11
推荐指数
1
解决办法
3万
查看次数

如何在android ndk中使用GraphicBuffer

我正在问这个问题,如何在Android中改进opengl es显示性能.我试图使用ndk-r9d构建使用GraphicBuffer的代码.但是说这个范围没有声明GraphicBuffer.对于eglCreateImageKHR和glEGLImageTargetTexture2DOES的相同注释.

我添加了EGL/eglext.h和GLES2/gl2ext.h.我试图包含ui/GraphicBuffer.h,但它没有接受它.是否有另一个头文件要添加?

下面给出的代码我添加了以避免使用glTexSubImage2D().

  GraphicBuffer * pGraphicBuffer = new GraphicBuffer(frame_width, frame_height, PIXEL_FORMAT_RGB_565, GraphicBuffer::USAGE_SW_WRITE_OFTEN | GraphicBuffer::USAGE_HW_TEXTURE);

        // Lock the buffer to get a pointer
        unsigned char * pBitmap = NULL;
        pGraphicBuffer->lock(GraphicBuffer::USAGE_SW_WRITE_OFTEN,(void **)&pBitmap);

        // Write 2D image to pBitmap
        memcpy(pBitmap, frame_buffer, frame_width * frame_height * 3);

        // Unlock to allow OpenGL ES to use it
        pGraphicBuffer->unlock();

        EGLClientBuffer ClientBufferAddress = pGraphicBuffer->getNativeBuffer();
        EGLint SurfaceType = EGL_NATIVE_BUFFER_ANDROID;

        // Make an EGL Image at the same address of the native client buffer
        EGLDisplay eglDisplayHandle …
Run Code Online (Sandbox Code Playgroud)

android opengl-es android-ndk egl

8
推荐指数
2
解决办法
9583
查看次数

如何提高android中opengl es的显示性能

我正在努力提高我们的视频会议项目在android中的视频显示效率。视频显示是用原生opengl代码实现的。opengl 代码是在 opengl 版本 1 中以本机实现的。下面给出的代码用于显示视频的每一帧。

int ofi_vc_video_display::render_video_frame(unsigned char *frame_buffer)
{

    // Check the frame is available or not. If available display the frame.
    if (frame_buffer != NULL){

        // Clear the screen buffers.
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        // Bind the frame data to the texture.
        glTexSubImage2D(GL_TEXTURE_2D,
                        0,
                        0,
                        0,
                        frame_width,
                        frame_height,
                        GL_RGB,
                        GL_UNSIGNED_BYTE,
                        frame_buffer);

        // Check for the error status.
        while ((gl_error_status=glGetError()) != GL_NO_ERROR) {

            error_status = gl_error_status;
          }

        // Transform and rotate the texture.
        glMatrixMode(GL_TEXTURE);
        glLoadIdentity();
        glTranslatef(0.5, 0.5, 0.0);
        glRotatef(180.0, …
Run Code Online (Sandbox Code Playgroud)

android opengl-es

3
推荐指数
1
解决办法
5159
查看次数

在Jelly Bean之前的Android中用于H.264的硬件加速视频解码

我正在开展视频会议项目.我们使用软件编解码器对视频帧进行编码和解码,这样可以在较低分辨率(高达320p)下正常工作.我们计划支持我们的应用程序,以获得高达720p的更高分辨率.我开始知道硬件加速可以很好地完成这项工作.

由于硬件编解码器api媒体编解码器可从Jelly Bean开始使用,我已将其用于编码和解码,并且工作正常.但我的应用程序得到2.3的支持.因此,我需要对30帧/秒的H.264帧进行硬件加速视频解码.

在研究中发现了通过修改舞台惊吓框架来使用OMX编解码器的想法.我读过H.264的硬件解码器可以从2.1获得,而编码器是从3.0开始.我已经浏览了本网站提供的许多文章和问题,并确认我可以继续.

我曾在这里阅读过怯场建筑-架构和这里- stagefright它是如何工作的

我在这里阅读OMX编解码器- 使用android-hardware-decoder-with-omxcodec-in-ndk.

我有一个起步问题和一些关于它的实现的混淆.我想有一些关于它的信息.

  1. 为了在我的代码中使用OMX编解码器,我应该使用整个android源代码树构建我的项目,还是可以通过添加来自AOSP源的一些文件来做(如果是的话,那就是全部).
  2. 从头开始我应该遵循哪些步骤来实现它.

有人可以给我一个指导方针

谢谢...

android hardware-acceleration android-ndk stagefright openmax

3
推荐指数
1
解决办法
3638
查看次数

Twilio:在Android客户端中获取子呼叫sid

目前,我正在处理语音和电话会议的通话费用计算部分。

我可以通过Rest apis(python)使用呼叫sid获得每个呼叫的Twilio价格。

现在,据我所知,当我从android客户端发出呼叫时-这将是对Twilio服务器的入站呼叫,并且它具有一个呼叫sid,我可以使用它在客户端进行获取

connection.getParameters().get(Connection.IncomingParameterCallSIDKey);
Run Code Online (Sandbox Code Playgroud)

然后,服务器将向客户端或指定为“ To”的电话号码进行出站呼叫,该电话号码将具有一个单独的呼叫sid,该呼叫id是上述呼叫的子代。

现在我的问题是如何获得这个孩子的呼叫sid?

还是有一种通过指定父呼叫sid来获取子呼叫sid的方法?

电话结束后我需要它。

python android twilio

1
推荐指数
1
解决办法
578
查看次数