This article is from Easydarwin Open source team to develop Holo blog: Http://blog.csdn.net/holo_easydarwin
Initially in doing Easypusher mobile phone live when encountered a problem: mobile phone vertical screen push live screen to Easydarwin and then play through the player video screen will rotate counterclockwise 90 degrees, as shown:
Mobile phone will not rotate when the screen, the problem is actually very simple, in the push to the server before the picture data rotation 90 degrees can be, and then do a clockwise rotation, the results of the screen into the following:
It's obvious that the picture rotates 90 degrees clockwise, but it's not as good as spinning. I took it for granted that the rotation algorithm was wrong, and then began to seek the Google degree Niang, and then the eggs, and then began to understand their own learning yuv420sp, yuv420p, and write their own rotation algorithm, the result is still so. In fact, there is a conclusion, the rotation algorithm is no problem. Where is it besides the problem? A chat about width and height is not a problem, a phrase to wake up in the dream of people. I use Mediacodec when I code, and the code is set to 640 high 480:
Mediaformat = Mediaformat.createvideoformat ("VIDEO/AVC", width,height);
1 1
and rotate 90 degrees after wide and high upside down ah, and then there must be a problem coding, and then in the encoder width and height upside down:
Mediaformat = Mediaformat.createvideoformat ("VIDEO/AVC", height, width);
1 1
This time there was a miracle, the picture is finally normal:
In fact, is simply reversed the width and height of the position, this problem plagued for several days, and finally solved
About code visible: Https://github.com/EasyDarwin/EasyPusher