Dynamic Adaptive Streaming over HTTP (DASH), also known as MPEG-DASH, is an adaptive bitrate streaming technique that enables high quality streaming of media content over the Internet delivered from conventional HTTP web servers. Similar to Apple's HTTP Live Streaming (HLS) solution, MPEG-DASH works by breaking the content into a sequence of small HTTP-based file segments, each segment containing a short interval of playback time of a content that is potentially many hours in duration, such as a movie or the live broadcast of a sports event.(wikipedia)
SnapDragon 810 Supports DASH?
We can find the Snapdragon 810 processor specs(link), as described in the table Specifications,SnapDragon 810 supports 4K capture and playback with H.264 (AVC) and H.265 (HEVC) formats and DASH.
How To Check?
Get Qualcomm license and download the source code for SnapDragon 810.Then you can find the source code path:
/external/mm-dash/
and
external/mm-dash/QCMediaPlayer/
check the Android.mk then we know, QCMediaPlayer will be Compiled to qcmediaplayer.jar, and put into system/framework. QCMediaPlayer extends MediaPlayer, so we can write a QCMediaPlayer Demo to check whether Qualcomm's chip support DASH.
The key code is as follows:
import com.qualcomm.qcmedia.*;
public class MainActivity extends Activity implements OnClickListener{
Button btnplay, btnstop, btnpause;
SurfaceView surfaceView;
QCMediaPlayer mediaPlayer;
int position;
public void onCreate(Bundle savedInstanceState) {
//... ...
mediaPlayer=new QCMediaPlayer();
surfaceView=(SurfaceView) this.findViewById(R.id.surfaceView);
surfaceView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
surfaceView.getHolder().addCallback(new Callback() {
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
if (position>0) {
try {
play();
mediaPlayer.seekTo(position);
position=0;
} catch (Exception e) {
}
}
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
}
});
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnplay:
play();
break;
case R.id.btnpause:
if (mediaPlayer.isPlaying()) {
mediaPlayer.pause();
}else{
mediaPlayer.start();
}
break;
case R.id.btnstop:
if (mediaPlayer.isPlaying()) {
mediaPlayer.stop();
}
break;
default:
break;
}
}
private void play() {
try {
mediaPlayer.reset();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
//mpd file path
mediaPlayer.setDataSource("http://yt-dash-mse-test.commondatastorage.googleapis.com/media/car-20120827-manifest.mpd");
mediaPlayer.setDisplay(surfaceView.getHolder());
mediaPlayer.prepare();
mediaPlayer.start();
} catch (Exception e) {
}
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<SurfaceView
android:id="@+id/surfaceView"
android:layout_width="fill_parent"
android:layout_height="360px" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<Button
android:id="@+id/btnplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Play" />
<Button
android:id="@+id/btnpause"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pause" />
<Button
android:id="@+id/btnstop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Stop" />
</LinearLayout>
</LinearLayout>
Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
#need add jar supports
LOCAL_JAVA_LIBRARIES := qcmediaplayer
# Only compile source java files in this apk.
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := DASHDemo
LOCAL_SDK_VERSION := current
include $(BUILD_PACKAGE)
# Use the following include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))
Remember to add network permission in AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
Finally, Compiled using mmm and installed the DASHDemo.apk to your SnapDragon 810 device.
Further More?
SONY released Multimedia for Android Library as an open source project to support DASH streaming. It's easy for application to support DASH streaming. More information please clickhere.