Android Voice Call

Source: Internet
Author: User

This time in the company's voice this piece, mainly to achieve the mobile phone and PC side of the voice call problem (Echo and noise cancellation temporarily not considered) is the AMR scheme.

The audio recording from the Android phone can be directly recorded in AMR format, eliminating the compression effort. However, if you broadcast AMR directly, it can only be done by file, which can lead to delay.

At present, the software is the use of Android itself to provide a hard decoding scheme, do not use their own soft decoding, mainly if the soft decoding program CPU occupancy rate will be high.

The recording aspect uses is Mediarecord Benku side sends. There is basically no difficulty.

Mobile phone playback because Mediaplay can only be played from the file or network, there is no way directly from the socket directly broadcast. So it takes the form of a file, the socket side writes the accepted data to the file, and then assigns the file descriptor to the MediaPlayer. This method of the problem if you write to the file too much data, the delay will be very large, if the amount of data written, then there will be a noticeable meal, the file this way will inevitably lead to a certain delay.

These two days in the test when you feel the file this way voice quality is too poor, and also found in the recording and playback of voice in the background of the MediaServer service CPU occupancy is not small, it is possible that the test of the phone on the hardware decoding is not very friendly. So I want to try soft decoding the case of how to run:

If you want to do soft decoding, such as AMR's decoding code, the PC is used AMR standard code, if you want to transplant to Android, you need to use the NDK to compile into a dynamic library, this thought is very simple, But in the process of android.mk, I was baffled, so make really bad writing, such as then re-learn a bit made, and then according to the code has ANDROID.MK good research, and finally completed.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/4C/DB/wKioL1RGaLajAoVsAAIdGmgSVSg325.jpg "title=" source directory " alt= "Wkiol1rgalajaovsaaidgmgsvsg325.jpg"/>


Too many source files, originally to make on the more headache.


This is my android.mk.

local_path := $ (Call my-dir) include $ (clear_vars) amrtool_src := $ (wildcard  $ (Local_path)/amrtool/*.cpp) amrtool_src := $ (amrtool_src:$ (Local_path)/amrtool/%=%) common_src : = $ (wildcard $ (Local_path)/amrnb/*.cpp) common_src := $ (common_src:$ (LOCAL_PATH)/amrnb/%=%) dec_src = $ (wildcard $ (Local_path)/amrnb/dec/*.cpp) dec_src := $ (dec_src:$ (LOCAL_PATH) /amrnb/dec/%=%) enc_src = $ (wildcard $ (Local_path)/amrnb/enc/*.cpp) enc_src := $ (enc_ src:$ (Local_path)/amrnb/enc/%=%) local_src_files :=    $ (amrtool_src:%=amrtool/%)     $ (common_src:%=amrnb/%)     $ (dec_src:%=amrnb/dec/%)      $ (enc_src:%=amrnb/enc/%) local_c_includes := $ (Local_path)/amrnb $ (LOCAL_PATH)/amrnb /dec $ (Local_path)/amrnb/enc local_module := amrlocal_cflags := -dandroid_ndk               -ddisable_importgl -wno-sequence-point - wno-extrainclude $ (Build_shared_library)


Android Voice Call

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.