Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AbemaTVを支えるアプリの優しさ / abematv_devcon_2017

Masaki Ogata
October 21, 2017

AbemaTVを支えるアプリの優しさ / abematv_devcon_2017

ネットワーク帯域などの限られたシステムリソースを節約するために、Androidアプリで取り組んでいる優しさをいくつか紹介します。

Masaki Ogata

October 21, 2017
Tweet

More Decks by Masaki Ogata

Other Decks in Technology

Transcript

  1. "CFNB57Λࢧ͑Δ
    ΞϓϦͷ༏͠͞

    View full-size slide

  2. .BTBLJ0HBUB
    "OESPJE&OHJOFFS"CFNB57 *OD
    IUUQTHJUIVCDPNPHBDMFKBQBO
    !PHBDMFKBQBO

    View full-size slide

  3. ༏͠͞ͱ͸ʁ

    View full-size slide

  4. Զࢯɿʮ͍ͨͩ·ʔʯ
    Շࢯɿʮ͓ؼΓʔɺ͝൧࡞ͬͯ͋ΔΑɻʯ
    Զࢯɿʢ೥ʹҰ౓ͷح੻ʜʣ༏͠͞ʂʂ

    View full-size slide

  5.  lࢥ͍΍Γ͕͋ͬͯ਌੾z
     ग़య.BDࣙॻΞϓϦεʔύʔେࣙྛ

    View full-size slide

  6. ΞϓϦͷ༏͠͞ͱ͸

    View full-size slide

  7. ωοτϫʔΫ௨৴Λ͍ͩ͡ʹ
    ΞϓϦͷͤ͘͞ΜGPS6TFS
    όοςϦʔΛ͔ͭ͏ͳ
    ΨϯΨϯ͍͜͏ͥ
    Ξχϝʔγϣϯͤ͞Ζ

    View full-size slide

  8. 6*ʗ69Λ͍ͩ͡ʹ
    ΞϓϦͷͤ͘͞ΜGPS4ZTUFN
    ωοτϫʔΫଳҬΛ࢖͏ͳ
    Ωϟογϡ͠Α͏ͥ
    ௿ίετͰӡ༻ͤ͞Ζ

    View full-size slide

  9.  lωοτϫʔΫ௨৴ྔΛ཈͑Δz
     "CFNB57ΞϓϦͷ༏͠͞

    View full-size slide

  10. "CFNB57Λࢧ͑Δ
    ΞϓϦͷ༏͠͞
     ʙ"OESPJEΞϓϦͷऔΓ૊Έʙ

    View full-size slide

  11. ݄๭೔ɻ
    ⚡࣌ؒੜ์ૹಛ൪ܾఆ⚡

    View full-size slide

  12. ෛՙରࡦΛਐΊͨ݁Ռɺ

    View full-size slide

  13. ༏͠͞ʹෆඋ͕͋Γ·ͨ͠

    View full-size slide

  14. "CFNB57Λࢧ͑Δ
    ΞϓϦͷ༏͠͞

    View full-size slide

  15. "CFNB57Λࢧ͑Δ
    ΞϓϦͷ༏͠͞
    XJUI

    View full-size slide

  16. ϓϨΠϦετऔಘ͠ա͗໰୊

    View full-size slide

  17. )-4ʢ)551-JWF4USFBNJOHʣ
    QMBZMJTU@MJWFNV
    &95.6
    &9597&34*0/
    &9595"3(&5%63"5*0/
    &959.&%*"4&26&/$&
    &95*/'
    UT
    &95*/'
    UT
    &95*/'
    UT

    View full-size slide

  18. )-4ʢ)551-JWF4USFBNJOHʣ
    QMBZMJTU@MJWFNV
    &95.6
    &9597&34*0/
    &9595"3(&5%63"5*0/
    &959.&%*"4&26&/$&
    &95*/'
    UT
    &95*/'
    UT
    &95*/'
    UT
    UT

    View full-size slide

  19. )-4ʢ)551-JWF4USFBNJOHʣ
    QMBZMJTU@MJWFNV
    &95.6
    &9597&34*0/
    &9595"3(&5%63"5*0/
    &959.&%*"4&26&/$&
    &95*/'
    UT
    &95*/'
    UT
    &95*/'
    UT
    UT
    UT

    View full-size slide

  20. )-4ʢ)551-JWF4USFBNJOHʣ
    QMBZMJTU@MJWFNV
    &95.6
    &9597&34*0/
    &9595"3(&5%63"5*0/
    &959.&%*"4&26&/$&
    &95*/'
    UT
    &95*/'
    UT
    &95*/'
    UT
    UT
    UT
    UT

    View full-size slide

  21. )-4ʢ)551-JWF4USFBNJOHʣ
    QMBZMJTU@MJWFNV
    &95.6
    &9597&34*0/
    &9595"3(&5%63"5*0/
    &959.&%*"4&26&/$&
    &95*/'
    UT
    &95*/'
    UT
    &95*/'
    UT
    UT
    UT
    UT

    View full-size slide

  22. )-4ʢ)551-JWF4USFBNJOHʣ
    QMBZMJTU@MJWFNV
    &95.6
    &9597&34*0/
    &9595"3(&5%63"5*0/
    &959.&%*"4&26&/$&
    &95*/'
    UT
    &95*/'
    UT
    &95*/'
    UT
    UT
    UT
    UT
    UT

    View full-size slide

  23. )-4"EBQUJWF4USFBNJOH
    NBTUFS@QMBZMJTUNV
    &95.6
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV

    View full-size slide

  24. )-4"EBQUJWF4USFBNJOH
    NBTUFS@QMBZMJTUNV
    &95.6
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    NV
    Q

    View full-size slide

  25. )-4"EBQUJWF4USFBNJOH
    NBTUFS@QMBZMJTUNV
    &95.6
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    NV
    Q

    NV
    Q

    View full-size slide

  26. ֤σόΠεͷϓϨΠϦετऔಘִؒ
    ϥΠϒ഑৴Ͱ54ϑΝΠϧͷηάϝϯτִ͕ؒඵͷ৔߹ɻ
    1$ 8
    J04 "OESPJE

    View full-size slide

  27. ֤σόΠεͷϓϨΠϦετऔಘִؒ
    ϥΠϒ഑৴Ͱ54ϑΝΠϧͷηάϝϯτִ͕ؒඵͷ৔߹ɻ
    1$ 8
    J04 "OESPJE
    ໿ඵִؒ ໿ඵִؒ

    View full-size slide

  28. ֤σόΠεͷϓϨΠϦετऔಘִؒ
    ϥΠϒ഑৴Ͱ54ϑΝΠϧͷηάϝϯτִ͕ؒඵͷ৔߹ɻ
    1$ 8
    J04 "OESPJE
    ໿ඵִؒ ໿ඵִؒ

    ໿
    ඵִؒ

    View full-size slide

  29. ݁࿦ɺ&YP1MBZFSͷෆ۩߹Ͱͨ͠ɻɻ
    IUUQTHJUIVCDPNHPPHMF
    &YP1MBZFSQVMM

    View full-size slide

  30. ߴϏοτϨʔτ΁੾ΓସΘΓޙ΋Q͕औಘ͞Εଓ͚͍ͯͨ
    NBTUFS@QMBZMJTUNV
    &95.6
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    NV
    Q

    NV
    Q

    View full-size slide

  31. ͜ΕͰ໰୊ղফ

    View full-size slide

  32. ը໘ʹ࠷దͳϏοτϨʔτ੍ޚ

    View full-size slide

  33. "CFNB57։ہ౰ॳ೥݄
    ΞϓϦ͸ԣը໘ݻఆͰࢹௌ໘ͷը໘αΠζ΋ύλʔϯͷΈɻ

    View full-size slide

  34. "CFNB57։ہप೥೥݄
    ΞϓϦ͸ैདྷͷԣը໘ʹՃ͑ɺॎը໘Ͱͷࢹௌʹ΋ରԠɻ

    View full-size slide

  35. "CFNB57։ہप೥೥݄
    ͞Βʹɺ"OESPJE৽ػೳͷϚϧν΢Οϯυ΢Ͱ΋ࢹௌՄೳʹɻ

    View full-size slide

  36. ࢹௌ໘ͷύλʔϯ͕ෳࡶԽʜ

    View full-size slide

  37. )-4"EBQUJWF4USFBNJOH
    NBTUFS@QMBZMJTUNV
    &95.6
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    NV
    Q

    NV
    Q

    View full-size slide

  38. )-4"EBQUJWF4USFBNJOH
    NBTUFS@QMBZMJTUNV
    &95.6
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    NV
    Q

    NV
    Q

    Q 'VMM)%
    Y

    View full-size slide

  39. )-4"EBQUJWF4USFBNJOH
    NBTUFS@QMBZMJTUNV
    &95.6
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    NV
    Q

    NV
    Q

    Y
    Q 'VMM)%
    Y

    View full-size slide

  40. )-4"EBQUJWF4USFBNJOH
    NBTUFS@QMBZMJTUNV
    &95.6
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    NV
    Q

    NV
    Q

    Y
    Q 'VMM)%
    Y
    ,
    ໿ഒͷ௨৴ྔʜ

    View full-size slide

  41. )-4"EBQUJWF4USFBNJOH
    NBTUFS@QMBZMJTUNV
    &95.6
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    &959ʜ #"/%8*%5)
    QMBZMJTU@MJWFNV
    NV
    Q

    NV
    Q

    Y
    Q 'VMM)%
    Y
    Q )%
    Y

    View full-size slide

  42. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    ͍͔ͭ͘ͷ৚݅Λ૊Έ߹ΘͤͯϏοτϨʔτΛಈతʹมߋ͍ͯ͠Δɻ
    ը࣭ઃఆ ௨৴ճઢ ը໘෯
    ࣗಈ
    ࠷ߴը࣭
    ߴը࣭
    ʜ
    8*'*
    .PCJMF
    ʜ
    8JOEPX෯
    7JFX෯
    ʜ
    04WFS
    YPSIJHIFS
    Y
    ʜ

    View full-size slide

  43. public class VideoBitrateAdjuster {
    private final VideoBitrateTable auto = new AutoBitrateTable();
    private final VideoBitrateTable legacy = new LegacyBitrateTable();
    private final VideoBitrateTable manual = new ManualBitrateTable();
    public VideoBitrate adjust(@Px int w, VideoQuality quality, NetworkState network) {
    if (quality == AUTO) {
    if (isLegacyPlatform()) {
    return legacy.lookup(w, quality, network);
    } else {
    return auto.lookup(w, quality, network);
    }
    } else {
    return manual.lookup(w, quality, network);
    }
    }
    "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    ˞αϯϓϧίʔυͰ͢

    View full-size slide

  44. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    public class LimitedBandwidthMeter implements BandwidthMeter {
    ...
    public setMaxBitrate(long bitrate) { ... }
    public long getBitrateEstimate() {
    return Math.min(bitrateEstimate, maxBitrate);
    }
    ...
    }
    package com.google.android.exoplayer2.upstream;
    public interface BandwidthMeter {
    long getBitrateEstimate();
    }
    ˞αϯϓϧίʔυͰ͢

    View full-size slide

  45. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    NV UT

    View full-size slide

  46. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    8*'*
    QY
    NV UT

    View full-size slide

  47. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    8*'*
    QY
    NV UT

    View full-size slide

  48. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    8*'*
    QY
    Q
    NV UT

    View full-size slide

  49. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    8*'*
    QY
    Q
    CQT
    NV UT

    View full-size slide

  50. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    8*'*
    QY
    Q
    CQT
    NBY#JUSBUFQ
    NV UT

    View full-size slide

  51. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    8*'*
    QY
    Q
    CQT
    NBY#JUSBUFQ
    NV UT

    View full-size slide

  52. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    8*'*
    QY
    Q
    CQT
    NBY#JUSBUFQ
    NV UT

    View full-size slide

  53. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    8*'*
    QY
    Q
    CQT
    NBY#JUSBUFQ
    NV
    UT
    Q

    View full-size slide

  54. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    8*'*
    QY
    Q
    CQT
    NBY#JUSBUFQ
    NV
    UT
    Q

    Q

    View full-size slide

  55. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    .0#*-&
    QY
    Q
    CQT
    NBY#JUSBUFQ
    NV
    UT
    Q

    Q

    View full-size slide

  56. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    .0#*-&
    QY
    Q
    CQT
    NBY#JUSBUFQ
    NV
    UT
    Q

    Q

    View full-size slide

  57. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    .0#*-&
    QY
    Q
    CQT
    NBY#JUSBUFQ
    NV
    UT
    Q

    Q

    View full-size slide

  58. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    .0#*-&
    QY
    Q
    CQT
    NBY#JUSBUFQ
    NV
    UT
    Q

    Q

    View full-size slide

  59. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    .0#*-&
    QY
    Q
    CQT
    NBY#JUSBUFQ
    NV
    UT
    Q

    Q

    View full-size slide

  60. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    .0#*-&
    QY
    Q
    CQT
    NBY#JUSBUFQ
    NV
    UT
    Q

    Q

    View full-size slide

  61. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    .0#*-&
    QY
    Q
    CQT
    NBY#JUSBUFQ
    NV
    UT
    Q

    Q

    View full-size slide

  62. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    .0#*-&
    QY
    Q
    CQT
    NBY#JUSBUFQ
    NV
    UT
    Q

    Q

    View full-size slide

  63. "CFNB57ΞϓϦͷϏοτϨʔτ੍ޚʢ"OESPJEʣ
    VideoBitrateAdjuster
    PlayerBitrateChanger LimitedBandwidthMeter ExoPlayer
    "650
    .0#*-&
    QY
    Q
    CQT
    NBY#JUSBUFQ
    NV
    UT
    Q

    Q

    View full-size slide

  64. ͢΂ͯ͸௨৴ྔΛ཈͑ΔͨΊ

    View full-size slide

  65. ·ͱΊ
    wϓϨΠϦετऔಘ͠ա͗໰୊
    ࠷৽ͷ&YP1MBZFSʢSʣΛར༻͢Ε͹ղফͰ͖Δɻ
    wը໘ʹ࠷దͳϏοτϨʔτ੍ޚ
    ଳҬ্ݶΛઃఆ͢Δ͜ͱͰແବͳ௨৴ྔΛ཈͑Δ͜ͱ͕Ͱ͖Δɻ

    View full-size slide

  66. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ

    View full-size slide

  67. 8F`SFIJSJOH
    IUUQTBCFNBHO[SBT

    View full-size slide